导入模块转换
一个类型库可以具有一个或多个包含常数定义和方法定义的模块。 在模块中定义的常数将当作类的公共、常数、静态成员导入,其名称与原模块相同。 不导入在模块外定义的常数。
类型库表示形式
[
uuid(12345678-1234-1234-1234-123456789ABC),
]
library TestConstants
{
[
uuid(12345678-1234-1234-1234-123456789ABC),
dllname("test.dll")
]
module Constants
{
const short FRAME_COLOR = 0x10;
const short WINDOW_COLOR = 0x20;
const short BUTTON_COLOR = 0x40;
…
};
};
转换的类型如下所示:
Public Class Constants
Public Const FRAME_COLOR As Short = &H10
Public Const WINDOW_COLOR As Short = &H20
Public Const BUTTON_COLOR As Short = &H40
End Class
public class Constants
{
public const short FRAME_COLOR = 0x10;
public const short WINDOW_COLOR = 0x20;
public const short BUTTON_COLOR = 0x40;
}