__identifier (C++/CLI)

可以使用 Visual c + + 关键字用作标识符。

所有平台

语法

__identifier(Visual_C++_keyword)

备注

使用__identifier标识符不是关键字的关键字是允许的但强烈建议不要作为一种样式。

Windows 运行时

hzc8ytsz.collapse_all(zh-cn,VS.110).gif要求

编译器选项:/ZW

hzc8ytsz.collapse_all(zh-cn,VS.110).gif示例

示例

在以下示例中,类名为template在 C# 中创建并将其作为 DLL 分发。 在 Visual c + + 程序中使用的template类, __identifier关键字之间的这一事实, template是一个标准的 c + + 关键字。

// identifier_template.cs
// compile with: /target:library
public class template {
   public void Run() { }
}

// keyword__identifier.cpp
// compile with: /ZW
#using <identifier_template.dll>
int main() {
   __identifier(template)^ pTemplate = ref new __identifier(template)();
   pTemplate->Run();
}

公共语言运行时

备注

__identifier关键字是有效的**/clr/clr:oldSyntax**编译器选项。

hzc8ytsz.collapse_all(zh-cn,VS.110).gif要求

编译器选项:/clr

hzc8ytsz.collapse_all(zh-cn,VS.110).gif示例

示例

在以下示例中,类名为template在 C# 中创建并将其作为 DLL 分发。 在 Visual c + + 程序中使用的template类, __identifier关键字之间的这一事实, template是一个标准的 c + + 关键字。

// identifier_template.cs
// compile with: /target:library
public class template {
   public void Run() { }
}

// keyword__identifier.cpp
// compile with: /clr
#using <identifier_template.dll>

int main() {
   __identifier(template) ^pTemplate = gcnew __identifier(template)();
   pTemplate->Run();
}

请参见

概念

适用于运行时平台的组件扩展

适用于运行时平台的组件扩展