RegionInfo.Equals Method (Object)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

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

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

Public Overrides Function Equals (
	value As Object
) As Boolean


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.

Imports System
Imports System.Globalization

Public Class SamplesRegionInfo   

   Public Shared Sub Main()

      ' Creates a RegionInfo using the ISO 3166 two-letter code.
      Dim myRI1 As New RegionInfo("US")

      ' Creates a RegionInfo using a CultureInfo.LCID.
      Dim myRI2 As New RegionInfo(New CultureInfo("en-US", False).LCID)

      ' Compares the two instances.
      If myRI1.Equals(myRI2) Then
         Console.WriteLine("The two RegionInfo instances are equal.")
         Console.WriteLine("The two RegionInfo instances are NOT equal.")
      End If 

   End Sub 'Main

End Class 'SamplesRegionInfo 

'This code produces the following output.


'The two RegionInfo instances are equal.

Universal Windows Platform
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Return to top