Equals Method
Collapse the table of content
Expand the table of content

RegionInfo.Equals Method

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

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.
*/


Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2017 Microsoft