VB.Net - TypeOf Operator

The TypeOf operator is used for checking if an object is of a particular type.
The way to check if an object is of a particular type is to use the TypeOf operator
This is frequently used in conjunction with the Is Operator.

If (TypeOf myobject Is Dog) Then 
End If

result = TypeOf x Is Integer

C# Equivalent

There is no equivalent in C#.
There is a typeof Operator in C# but it has a different meaning - which is extremely confusing.


This operator is available in VBA

© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext