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.

RegionInfo.Equals Method (Object)

Determines whether the specified object is the same instance as the current RegionInfo.

Namespace: System.Globalization
Assembly: mscorlib (in mscorlib.dll)

public override bool Equals (
	Object value
)
public boolean Equals (
	Object value
)
public override function Equals (
	value : Object
) : boolean

Parameters

value

The object to compare with the current RegionInfo.

Return Value

true if the value parameter is a RegionInfo object and its Name property is the same as the Name property of the current RegionInfo object; otherwise, false.

This method overrides Object.Equals.

The following code example compares two instances of RegionInfo that were created differently.

using System;
using System.Globalization;

public class SamplesRegionInfo  {

   public static void Main()  {

      // Creates a RegionInfo using the ISO 3166 two-letter code.
      RegionInfo myRI1 = new RegionInfo( "US" );

      // Creates a RegionInfo using a CultureInfo.LCID.
      RegionInfo myRI2 = new RegionInfo( new CultureInfo("en-US",false).LCID );

      // Compares the two instances.
      if ( myRI1.Equals( myRI2 ) )
         Console.WriteLine( "The two RegionInfo instances are equal." );
      else
         Console.WriteLine( "The two RegionInfo instances are NOT equal." );

   }

}

/*
This code produces the following output.

The two RegionInfo instances are equal.

*/

import System.*;
import System.Globalization.*;

public class SamplesRegionInfo
{   
    public static void main(String[] args)
    {
        // Creates a RegionInfo using the ISO 3166 two-letter code.
        RegionInfo myRI1 =  new RegionInfo("US");

        // Creates a RegionInfo using a CultureInfo.LCID.
        RegionInfo myRI2 =  
            new RegionInfo((new CultureInfo("en-US", false)).get_LCID());

        // Compares the two instances.
        if (myRI1.Equals(myRI2)) {
            Console.WriteLine("The two RegionInfo instances are equal.");
        }
        else {
            Console.WriteLine("The two RegionInfo instances are NOT equal.");
        }
    } //main
} //SamplesRegionInfo

/*
This code produces the following output.

The two RegionInfo instances are equal.

*/

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.

.NET Framework

Supported in: 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2014 Microsoft