C# – The ‘is’ and ‘as’ operators
The as operator tries to convert an object to the target type: The is operator returns true if the object can be converted to the target type: You can also use the is operator to declare a variable of the target type (this is referred to as the declaration pattern). This is a nice shortcut. … Read more