|
'is' |
'as' |
Function |
If the run-time type of an expression result is compatible with a given type, the 'is' operator is checked by it. |
'as' operator is used to perform conversion between compatible reference types or Nullable types. |
Type |
Boolean |
Non-Boolean |
Return type when conversion happens successfully |
If the given object is of the same type, then 'is' sends true |
'as' sends object when the type of object is compatible with the given type |
Return type when conversion not possible |
If the given object is not of the same type, then 'is' sends false |
'as' returns null if conversion not possible |
Use Case |
'is' is used for Only Boxing Unboxing and reference conversions |
'as' operator is used only for nullable, reference and boxing conversions |