Type.Equals Method (Type)
.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 Type.
Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly: mscorlib (in mscorlib.dll)
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.
using namespace System; using namespace System::Reflection; int main() { int a = 1; float b = 1; Console::WriteLine( "{0}", a.Equals( b ) ); b = (float)a; Console::WriteLine( "{0}", a.Equals( b ) ); } //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.
Community Additions
ADD
Show: