C# TypeInfo Equals(Type)
Description
TypeInfo Equals(Type)
Determines if the underlying
system type of the current Type is the same as the underlying system type of
the specified Type.
Syntax
TypeInfo.Equals(Type)
has the following syntax.
public virtual bool Equals(
Type o
)
Parameters
TypeInfo.Equals(Type)
has the following parameters.
o
- The object whose underlying system type is to be compared with the underlying system type of the current Type.
Returns
TypeInfo.Equals(Type)
method returns true if the underlying system type of o is the same as the underlying system
type of the current Type; otherwise, false.
Example
The following example uses Equals to compare two types.
/*from w w w.j a va 2s .c om*/
using System;
using System.Reflection;
class Example
{
public static void Main()
{
Type a = typeof(System.String);
Type b = typeof(System.Int32);
Console.WriteLine("{0} == {1}: {2}", a, b, a.Equals(b));
}
}
The code above generates the following result.