Type.Equals Method (Object)
.NET Framework 2.0
Determines if the underlying system type of the current Type is the same as the underlying system type of the specified Object.
Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly: mscorlib (in mscorlib.dll)
public boolean Equals ( Object o )
public override function Equals ( o : Object ) : boolean
Parameters
- o
The Object 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. This method also returns false if the object specified by the o parameter is not a Type.This method overrides Object.Equals.
The following example uses Equals to compare two Object instances.
using System; using System.Reflection; class EqType { public static void Main(String[] args) { Type a = typeof(EqType); Type b = typeof(Type); Console.WriteLine("{0}", a.Equals(b).ToString()); b = (new EqType()).GetType(); Console.WriteLine("{0}", a.Equals(b).ToString()); } }
import System.*;
import System.Reflection.*;
class EqType
{
public static void main(String[] args)
{
Type a = EqType.class.ToType();
Type b = Type.class.ToType();
Console.WriteLine("{0}", System.Convert.ToString(a.Equals(b)));
b = (new EqType()).GetType();
Console.WriteLine("{0}", System.Convert.ToString(a.Equals(b)));
} //main
} //EqType
import System; import System.Reflection; class EqType { public static function Main() : void { var a = EqType; var b = Type; Console.WriteLine("{0}", a.Equals(b).ToString()); b = (new EqType).GetType(); Console.WriteLine("{0}", a.Equals(b).ToString()); } } EqType.Main();
This code produces the following output:
False
True
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.
Community Additions
ADD
Show: