as Operator in C# with Examples – Programming, Pseudocode Example, C# Programming Example
C# C# Console

as Operator in C# with Examples

In this tutorial,we’ll learn How to use ‘as’ operator in C#.

The “as” operator perform conversions between compatible types. It is like a cast operation and it performs only reference conversions, nullable conversions, and boxing conversions. The as operator can’t perform other conversions, such as user-defined conversions, which should instead be performed by using cast expressions.

The following is an example showing the usage of as operation in C#. Here ‘as’ is used for conversion:

Try to run the following code to work with ‘as’ operator in C# −



Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: