Use the "is" operator to see if an object can be converted into another type in C#
The "is" operator lets you compare determine whether you can convert an object to a type. For example, suppose the Student class inherits from Person, and that a_student and a_person are objects from the obvious classes. Then the following statements return the indicated results.
a_student is Person ' True.
a_student is Student ' True.
a_person is Person ' True.
a_person is Student ' False.



Comments