Export (0) Print
Expand All

RegionInfo.Equals Method

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

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

public override bool Equals(
	Object value
)

Parameters

value
Type: System.Object
The object to compare with the current RegionInfo.

Return Value

Type: System.Boolean
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 Example
{
   public static void Demo(System.Windows.Controls.TextBlock outputBlock)
   {
      // Creates a RegionInfo using the es-US culture name.
      RegionInfo myRI1 = new RegionInfo("es-US");

      // Creates a RegionInfo using a CultureInfo Name property
      RegionInfo myRI2 = new RegionInfo(new CultureInfo("en-US").Name);

      // Compares the two instances.
      if (myRI1.Equals(myRI2))
         outputBlock.Text += "The two RegionInfo instances are equal." + "\n";
      else
         outputBlock.Text += "The two RegionInfo instances are NOT equal." + "\n";
   }
}
/*
This code produces the following output.
   The two RegionInfo instances are equal.
*/


Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions

ADD
Show:
© 2014 Microsoft