This question is taken from the book .NET interview questions written by Shivprasad Koirala.
“IS” keyword is useful to check if objects are compatible with a type. For instance in the below code we are checking if “ocust” object is a type of “Customer” class.
object ocust = new Customer();
if (ocust is Customer)
“AS” keyword helps to do conversion from one type to other type. For instance in the below code we are converting object to a string data type.
object o = "interview";
string str = o as string;
You can also see the below youtube video created by www.questpond.com which explains the difference between "IS" and "AS" keyword practically.
We are thankful to http://www.questpond.com for their continuous support to maintain this blog. They have c# and .NET interview question with answer video services , do visit our sponsor once.