Use Equals to compare two types. : Type « Reflection « VB.Net Tutorial






Imports System
Imports System.Reflection

Class Example
    Public Shared Sub Main() 
        Dim a As Type = GetType(System.String)
        Dim b As Type = GetType(System.Int32)

        Console.WriteLine("{0} = {1}: {2}", a, b, a.Equals(b))

        a = GetType(Example)
        b = New Example().GetType()
        Console.WriteLine("{0} is equal to {1}: {2}", a, b, a.Equals(b))

        b = GetType(Type)
        Console.WriteLine("typeof({0}).Equals(typeof({1})): {2}", a, b, a.Equals(b))
    End Sub 
End Class








19.6.Type
19.6.1.Retrieves the type associated with the CLSID from the local host
19.6.2.Get the method that matches the specified binding flags.
19.6.3.Use CType to convert decimal and Decimal to byte
19.6.4.Retrieve a type by passing a ProgID
19.6.5.Displays the public or non-public get accessor for the specified property.
19.6.6.Use Equals to compare two types.
19.6.7.Create an instance of a Type array representing the number, order and type of the parameters for the property.
19.6.8.Display the ClassID related to the ProgID, along with any applicable exception message.