Udostępnij za pośrednictwem


RegionInfo.Equals Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

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

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

Syntax

'Declaration
Public Overrides Function Equals ( _
    value As Object _
) As Boolean
public override bool Equals(
    Object value
)

Parameters

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.

Remarks

This method overrides Object.Equals.

Examples

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

Imports System.Globalization


Public Class Example

   Public Shared Sub Demo(ByVal outputBlock As System.Windows.Controls.TextBlock)

      ' Creates a RegionInfo using the es-US culture name.
      Dim myRI1 As New RegionInfo("es-US")

      ' Creates a RegionInfo using a CultureInfo name.
      Dim myRI2 As New RegionInfo(New CultureInfo("en-US").Name)

      ' Compares the two instances.
      If myRI1.Equals(myRI2) Then
         outputBlock.Text &= "The two RegionInfo instances are equal." & vbCrLf
      Else
         outputBlock.Text &= "The two RegionInfo instances are NOT equal." & vbCrLf
      End If
   End Sub
End Class 
' This example produces the following output.
'       The two RegionInfo instances are equal.
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.
*/

Version Information

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

Platforms

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