Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Type.Equals Method (Type)

Determines if the underlying system type of the current Type is the same as the underlying system type of the specified Type.

Namespace: System
Assembly: mscorlib (in mscorlib.dll)

'Declaration
Public Function Equals ( _
	o As Type _
) As Boolean
'Usage
Dim instance As Type
Dim o As Type
Dim returnValue As Boolean

returnValue = instance.Equals(o)
public final boolean Equals (
	Type o
)
public final function Equals (
	o : Type
) : boolean

Parameters

o

The Type whose underlying system type is to be compared with the underlying system type of the current Type.

Return Value

true if the underlying system type of o is the same as the underlying system type of the current Type; otherwise, false.

The following example uses Equals to compare two types.

Imports System
Imports System.Reflection

Class EqType
    
    Public Shared Sub Main()
        Dim a As Integer = 1
        Dim b As Single = 1
        Console.WriteLine("{0}", a.Equals(b).ToString())
        b = a
        Console.WriteLine("{0}", a.Equals(b).ToString())
    End Sub
End Class

'This code produces the following output:
'False
'False

import System.*;
import System.Reflection.*;

class EqType
{
    public static void main(String[] args)
    {
        int a = 1;
        float b = 1;
        Console.WriteLine("{0}", System.Convert.ToString 
            (((Int32)(a)).Equals(System.Convert.ToDecimal(b))));
        b = a;
        Console.WriteLine("{0}", System.Convert.ToString
            (((Int32)(a)).Equals(System.Convert.ToDecimal(b))));
        
    } //main
} //EqType

//This code produces the following output:
//False
//False

import System;
import System.Reflection;

class EqType
{
  public static function Main() : void 
  {
   var a : int= 1;
   var b : float = 1;
   Console.WriteLine("{0}", a.Equals(b).ToString());
   b=float(a);
   Console.WriteLine("{0}", a.Equals(b).ToString());
  }
}
EqType.Main();
//This code produces the following output:
//False
//False

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2014 Microsoft