Condividi tramite


__identifier 

Enables the use of C++ keywords as identifiers.

__identifier(C++_keyword)

Remarks

The __identifier keyword enables the use of 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).

Note

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.

Example

In the following example, a C# class (called template) is created and consumed in the 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();
}

See Also

Concepts

New C++ Language Features