| '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 |
The Difference Between 'is' and 'as' Operators
The difference between 'is' and 'as' operators.'is' checks compatibility of runtime type, 'as' converts compatible types. 'is' sends true if types match, false if not. 'as' returns object if compatible, null if not. 'is' for type compatibility check, 'as' for conversions.

Join the conversation! Your thoughts help the community grow.