Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

__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

Community Additions

ADD
Show:
© 2015 Microsoft