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.

Single.Equals Method

Returns a value indicating whether this instance is equal to a specified object.

[Visual Basic]
Overrides Public Function Equals( _
   ByVal obj As Object _
) As Boolean
[C#]
public override bool Equals(
 object obj
);
[C++]
public: bool Equals(
 Object* obj
);
[JScript]
public override function Equals(
   obj : Object
) : Boolean;

Parameters

obj
An object to compare with this instance.

Return Value

true if obj is an instance of Single and equals the value of this instance; otherwise, false.

Example

[Visual Basic, C#, C++] The following sample demonstrates the Equals method.

[Visual Basic] 
Obj1 = CType(500, Single)

If A.Equals(Obj1) Then
    Console.WriteLine("The value type and reference type values are equal.")
End If

[C#] 
obj1 = (Single)500;
if (a.Equals(obj1)) {
    Console.WriteLine("The value type and reference type values are equal.");
}

[C++] 
obj1 = __box((Single)500);
if (__box(a)->Equals(obj1)) {
   Console::WriteLine(S"The value type and reference type values are equal.");
}

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework, Common Language Infrastructure (CLI) Standard

See Also

Single Structure | Single Members | System Namespace | CompareTo

Show:
© 2014 Microsoft