In C#:
As of C23 typeof is a part of the C standard. The operator typeof_unqual was also added which is the same as typeof, except it removes cvr-qualification and atomic qualification.67
In a non-standard (GNU) extension of the C programming language, typeof may be used to define a general macro for determining the maximum value of two parameters:
Java does not have a keyword equivalent to typeof. All objects can use Object's getClass() method to return their class, which is always an instance of the Class class. All types can be explicitly named by appending ".class", even if they are not considered classes, for example int.class and String[].class . There is also the instanceof operator for type introspection which takes an instance and a class name, and returns true for all subclasses of the given class.
In JavaScript:
In TypeScript:8
In VB.NET, the C# variant of "typeof" should be translated into the VB.NET's GetType method. The TypeOf keyword in VB.NET is used to compare an object reference variable to a data type.
The following example uses TypeOf...Is expressions to test the type compatibility of two object reference variables with various data types.
"TypeOf Operator (Visual Basic)". MSDN. Archived from the original on Nov 28, 2016. https://web.archive.org/web/20161128133108/https://msdn.microsoft.com/en-us/library/0ec5kw18(VS.80).aspx ↩
"typeof (C#)". MSDN. Archived from the original on Sep 10, 2016. https://web.archive.org/web/20160910105030/https://msdn.microsoft.com/en-us/library/58918ffs(VS.80).aspx ↩
"Declarations - D Programming Language 1.0". Digital Mars. Dec 30, 2012. Archived from the original on Oct 7, 2023. http://digitalmars.com/d/1.0/declaration.html#Typeof ↩
"Typeof" in "Using the GNU Compiler Collection". https://gcc.gnu.org/onlinedocs/gcc/Typeof.html ↩
Meneide, JeanHeyd (2021-03-07). "Not-So-Magic - typeof(…) in C | r2". Open Standards. Retrieved 2021-12-02. http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2685.htm ↩
"N2927: Not-so-magic - typeof for C". Open Standards. 2022-02-02. Archived from the original on Dec 1, 2023. https://open-std.org/JTC1/SC22/WG14/www/docs/n2927.htm ↩
"Consider renaming remove_quals" (PDF). Open Standards. 2022-02-06. Archived (PDF) from the original on Feb 17, 2024. https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2930.pdf ↩
"Using 'typeof' to infer a type". Learn TypeScript. Retrieved 2022-01-28. https://learntypescript.dev/08/l4-typeof-infer/ ↩