Interviews2 answers
What is the difference between “as” and “is” operators in C#?
2 Answers
As operator and is operator both are used for typecasting check. As operator is safe way of doing type cast because it will return null in case it fails to type cast. Is also does the same thing but it will throw exception in case it fails to type cast.
Jignesh KumarPosted Aug 26, 2018, 3:29 AM EDT
“as” operator is used for casting object to type or class.
“is” operator is used for checking the object with type and this will return a Boolean value.
Vivek KumarPosted Feb 8, 2016, 8:21 AM EST


