Type.Equals Method (Object)
Determines if the underlying system type of the current Type object is the same as the underlying system type of the specified Object.
Assembly: mscorlib (in mscorlib.dll)
Parameters
- o
-
Type:
System.Object
The object whose underlying system type is to be compared with the underlying system type of the current Type. For the comparison to succeed, o must be able to be cast or converted to an object of type Type.
Return Value
Type: System.Booleantrue 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: .
o is null.
o cannot be cast or converted to a Type object.
This method overrides Object.Equals. It casts o to an object of type Type and calls the Type.Equals(Type) method.
The following example uses Equals(Object) to compare various Type object instances with various Object instances.
Two things are particularly worth noting about the example:
The comparison of a Type object that represents an integer with a TypeInfo object that represents an integer return true because TypeInfo is derived from Type.
The comparison of a Type object that represents a IList<'T> object (an open generic type) with a List(Of String) object (a closed generic type) returns false.
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1