Lecture overview -- Keyboard shortcut: 'u'  Previous page: Static and dynamic types in C# -- Keyboard shortcut: 'p'  Next page: Examples of type test and type conversion -- Keyboard shortcut: 'n'  Lecture notes - all slides together  Annotated slide -- Keyboard shortcut: 't'  Textbook -- Keyboard shortcut: 'v'  Alphabetic index  Help page about these notes  Course home    Specialization, Extension, and Inheritance - slide 33 : 40

Type test and type conversion in C#

It is possible to test if the dynamic type of variable v is class type C

There are two ways to convert (cast) one class type to another

The typeof operator can be applied on a typename to obtain the corresponding object of class Type

The Object.GetType instance method returns an object of class Type that represents the run-time type of the receiver.