object.GetType()

Also called the GetType Method
This method operators on an object instance.
System.Type.GetType("System.Int32")


if (control.GetType().Name.Equals("TreeView")) 
{ }

switch (myobject.GetType().ToString()) 
{
   case "" : break;

}

object.GetType()            // System.Int32 
object.GetType().Name // Int32

GetType().Name()
GetType().FullName
The object must be instantiated


This method is also available in VB.Net

Dim sVariable As String 
Dim oType As Type = sVariable.GetType()

VB.Net

The equivalent in VB.Net is the TypeName function.


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