Friday, December 27, 2013

Visual C# - Avoiding Conflicts with Keywords

As a programmer, we all should be aware that keywords of a programming language cannot be used as identifiers. That is the case for Visual C# as well. We cannot use a keyword as an identifier. As we are aware that .NET framework is multilingual such conflicts can happen when we are referring libraries written in another language. An identifier in the external library can be conflicting with C# language.
The way to avoid this is by using the '@' symbol as a prefix to such identifiers. Ideally we cannot use 'class' as an identifier in C#. But this can be made possible by using it as '@class'. This is legal and is same as 'class'.

This is not the case for contextual keywords. They can be used as identifiers without '@' symbol. Ambiguity cannot arise within the context in which they are used.
Hope this helps !!!

No comments:

Configuration for CRM Plugins

CRM plugins are always great feature where we can automate many functionality which we cannot automate from user interface. But almost eve...