Equals Method

RuntimeHelpers.Equals Method (Object, Object)

 

Determines whether the specified Object instances are considered equal.

Namespace:   System.Runtime.CompilerServices
Assembly:  mscorlib (in mscorlib.dll)

public static bool Equals(
	object o1,
	object o2
)

Parameters

o1
Type: System.Object

The first object to compare.

o2
Type: System.Object

The second object to compare.

Return Value

Type: System.Boolean

true if the o1 parameter is the same instance as the o2 parameter, or if both are null, or if o1.Equals(o2) returns true; otherwise, false.

This method is used by compilers.

The following example demonstrates how to compare two objects by using the Equals method.

using System;
using System.Runtime.CompilerServices;


class Program
{

    static void Main(string[] args)
    {

        int x = 1; int y = 1;

        bool ret = RuntimeHelpers.Equals(x, y);

        Console.WriteLine("The return value of RuntimeHelpers.Equals is: " + ret);

    }
}

.NET Framework
Available since 1.1
Return to top
Show:
© 2016 Microsoft