*** Welcome to piglix ***

Typeof


typeof, alternately also typeOf, and TypeOf, is an operator provided by several programming languages to determine the data type of a variable. This is useful when constructing programs that must accept multiple types of data without explicitly specifying the type.

In languages that support polymorphism and type casting, the typeof operator may have one of two distinct meanings when applied to an object. In some languages, such as Visual Basic, the typeof operator returns the dynamic type of the object. That is, it returns the true, original type of the object, irrespective of any type casting. In these languages, the typeof operator is the method for obtaining run-time type information.

In other languages, such as C# or D and some nonstandard extensions to C and C++, the typeof operator returns the static type of the operand. That is, it evaluates to the declared type at that instant in the program, irrespective of its original form. These languages usually have other constructs for obtaining run-time type information, such as typeid.

The GNU compiler (GCC) extensions for the C programming language provide typeof:

In C#:

In VB.NET, he C# variant of "typeof" should be translated into the VB.NET's GetType method. TypeOf keyword in VB.NET is used to compare an object reference variable to a data type.


...
Wikipedia

...