Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

__identifier

Enables the use of Visual C++ keywords as identifiers.

__identifier(Visual_C++_keyword)

The __identifier keyword enables the use of Visual C++ keywords as identifiers, allowing a /clr program to use identifiers that are Visual C++ reserved words from referenced metadata.

For more information, see /clr (Common Language Runtime Compilation).

NoteNote:

Use of the __identifier keyword for identifiers that are not keywords is permitted, but strongly discouraged as a matter of style.

The __identifier keyword is valid with /clr and /clr:oldSyntax.

In the following example, a C# class (called template) is created and consumed in the Visual C++ program:

// 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();
}

Compiler option: /clr

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.