Wednesday, October 29, 2008

Contextual Keywords in C#

Contextual Keywords in C#

Keywords are predefined reserved identifiers that have special meanings to the compiler. They cannot be used as identifiers in program unless they include @ as a prefix. For example, @if is a legal identifier but if is not because it is a keyword.

A contextual keyword is used to provide a specific meaning in the code, but it is not a reserved word in C#.

forexample :

var query = from customer in db.Customer where"Chennai"
select customer;

here where is the Contextual keyword it has significant meaning , but outside of this statement where has no meaning so we can use as an identifier.

C# Contextual Keywords

get , partial , set ,value , where , yield


No comments: