Context-Sensitive Keywords
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. ArchiveDisclaimer

Context-Sensitive Keywords

Some language elements are only recognized in specific contexts. These are known as context-sensitive keywords. Outside the specific context, a context-sensitive keyword can be a user-defined symbol.

For readability purposes, you may want to limit your use of context-sensitive keywords as user–defined symbols.

The following are context-sensitive keywords:

The following sample shows that property, a context-sensitive keyword, can be used to define a property and a variable.

// context_sensitive_keywords.cpp
// compile with: /clr
public ref class C {
   int MyInt;
   C() : MyInt(99) {}

   property int Property_Block {
      int get() { return MyInt; }

int main() {
   int property = 0;
   C ^ MyC = gcnew C();
   property = MyC->Property_Block;

Compiler option: /clr

© 2016 Microsoft