SiteMap  | About    

The Is and As Operators in C#

Both 'is' and 'as' keywords are used for type casting in C#.

IS Operator

Is Operator is used to Check the Compatibility of an Object with a given Type and it returns the result as a Boolean i.e. True Or False.

In the above code the keyword checks whether the value on its left side is an instance of the type on the right side.

AS Operator

As Operator is used for Casting of Object to a given Type or a Class. The as keyword is used to cast nullable types if the specified value is not an instance of the specified type.

Value Type and Reference Type

The Types in .NET Framework are either treated by Value Type or by Reference Type. A Value Type holds the data within its own memory allocation and a Reference Type contains a pointer to another memory location that holds the real data. More on... Value Type and Reference Type

Dynamic Data Type

The dynamic keyword brings exciting new features to C# 4. Dynamic Type means that you can store any type of value in the dynamic data type variable because type checking for dynamic types of variables takes place at run-time. More about.... Dynamic Data Type (C) 2017    Founded by raps mk
All Rights Reserved. All other trademarks are property of their respective owners.