“IS” operator is useful to check if objects are compatible with a type. For instance in the below code we are checking if “stud” object is a type of “Student” class.
object stud = new Student(); if(stud== Student) {
“AS” operator 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. If the “AS” operator is not able to type cast it returns NULL
object obj = "Anupam"; string str = obj as string;
Markdown for AI
A clean, structured version of this page for AI assistants and LLMs.
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy.
“IS” operator is useful to check if objects are compatible with a type. For instance in the below code we are checking if “stud” object is a type of “Student” class.
“AS” operator 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. If the “AS” operator is not able to type cast it returns NULL