description | title | ms.date | ms.topic | f1_keywords | helpviewer_keywords | ms.assetid | |||
---|---|---|---|---|---|---|---|---|---|
Learn more about: __identifier (C++/CLI) | __identifier (C++/CLI) | 10/12/2018 | reference |
|
| 348428af-afa7-4ff3-b571-acf874301cf2 |
Enables the use of C++ keywords as identifiers.
__identifier(C++_keyword)
Use of the __identifier keyword for identifiers that are not keywords is permitted, but strongly discouraged as a matter of style.
Compiler option: /ZW
Example
In the following example, a class named template
is created in C# and distributed as a DLL. In the C++/CLI program that uses the template
class, the __identifier
keyword conceals the fact that template
is a standard C++ keyword.
// identifier_template.cs// compile with: /target:librarypublicclasstemplate{publicvoidRun(){}}
// keyword__identifier.cpp// compile with: /ZW #using <identifier_template.dll> intmain() { __identifier(template)^ pTemplate = ref new__identifier(template)(); pTemplate->Run(); }
The __identifier keyword is valid with the /clr
compiler option.
Compiler option: /clr
In the following example, a class named template
is created in C# and distributed as a DLL. In the C++/CLI program that uses the template
class, the __identifier
keyword conceals the fact that template
is a standard C++ keyword.
// identifier_template.cs// compile with: /target:librarypublicclasstemplate{publicvoidRun(){}}
// keyword__identifier.cpp// compile with: /clr #using <identifier_template.dll> intmain() { __identifier(template) ^pTemplate = gcnew __identifier(template)(); pTemplate->Run(); }
Component Extensions for .NET and UWP
Component Extensions for .NET and UWP