Context-Sensitive Keywords (C++/CLI and C++/CX)
Context-sensitive keywords are language elements that are recognized only in specific contexts. Outside the specific context, a context-sensitive keyword can be a user-defined symbol.
All Runtimes
Remarks
The following is a list of context-sensitive keywords:
internal
where
(part of Generics)
For readability purposes, you may want to limit your use of context-sensitive keywords as user-defined symbols.
Windows Runtime
Remarks
(There are no platform-specific remarks for this feature.)
Requirements
Compiler option: /ZW
Common Language Runtime
Remarks
(There are no platform-specific remarks for this feature.)
Requirements
Compiler option: /clr
Examples
The following code example shows that in the appropriate context, the property
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;
public:
C() : MyInt(99) {}
property int Property_Block { // context-sensitive keyword
int get() { return MyInt; }
}
};
int main() {
int property = 0; // variable name
C ^ MyC = gcnew C();
property = MyC->Property_Block;
System::Console::WriteLine(++property);
}
100
See also
Feedback
https://aka.ms/ContentUserFeedback.
În curând: Pe parcursul anului 2024, vom elimina treptat Probleme legate de GitHub ca mecanism de feedback pentru conținut și îl vom înlocui cu un nou sistem de feedback. Pentru mai multe informații, consultați:Trimiteți și vizualizați feedback pentru