Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
__identifier
Collapse the table of content
Expand the table of content

__identifier

Enables the use of C++ keywords as identifiers.

__identifier(C++_keyword)

Remarks

The __identifier keyword enables the use of C++ keywords as identifiers. The main purpose of this keyword is to allow managed classes to access and use external classes that may use a C++ keyword as an identifier. For more information on __identifier, see 22 __identifier Keyword.

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

Example

In the following example, a C# class (called template) is created and assigned to pTemplate:

// identifier_template.cs
// compile with: /target:library
public class template
{
   public void Run()
   {
   }
}
// keyword__identifier.cpp
// compile with: /clr
#using <mscorlib.dll>
#using <identifier_template.dll>   // defines a C# class called template

int main()
{
   __identifier(template) *pTemplate = new __identifier(template)();
   pTemplate->Run();
   return 0;
}

See Also

Managed Extensions for C++ Reference | C++ Keywords

Show:
© 2015 Microsoft