Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Reserved word
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Reserved words and language independence== Microsoft's [[.NET Framework|.NET]] [[Common Language Infrastructure]] (CLI) specification allows code written in 40+ different programming languages to be combined into a final product. Because of this, identifier/reserved word collisions can occur when code implemented in one language tries to execute code written in another language. For example, a [[Visual Basic (.NET)]] library may contain a [[Class (computer programming)|class]] definition such as: <syntaxhighlight lang="vbnet"> ' Class Definition of This in Visual Basic.NET: Public Class this ' This class does something... End Class </syntaxhighlight> If this is compiled and distributed as part of a toolbox, a [[C Sharp (programming language)|C#]] programmer, wishing to define a variable of type "<code>this</code>" would encounter a problem: <code>'this'</code> is a reserved word in C#. Thus, the following will not compile in C#: <syntaxhighlight lang="csharp"> // Using This Class in C#: this x = new this(); // Won't compile! </syntaxhighlight> A similar issue arises when accessing members, overriding [[virtual method]]s, and identifying namespaces. This is resolved by [[Stropping (syntax)|stropping]]. To work around this issue, the specification allows placing (in C#) the [[at-sign]] before the identifier, which forces it to be considered an identifier rather than a reserved word by the compiler: <syntaxhighlight lang="csharp"> // Using This Class in C#: @this x = new @this(); // Will compile! </syntaxhighlight> For consistency, this use is also permitted in non-public settings such as local variables, parameter names, and private members.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)