RegionInfo.Equals(Object) Methode

Definition

Bestimmt, ob das angegebene Objekt dieselbe Instanz wie die aktuelle RegionInfoist.

public:
 override bool Equals(System::Object ^ value);
public override bool Equals(object value);
override this.Equals : obj -> bool
Public Overrides Function Equals (value As Object) As Boolean

Parameter

value
Object

Das Objekt, das mit dem aktuellen RegionInfoverglichen werden soll.

Gibt zurück

truewenn der value Parameter ein RegionInfo Objekt ist und seine Name Eigenschaft mit der Name Eigenschaft des aktuellen RegionInfo Objekts identisch ist; andernfalls . false

Beispiele

Im folgenden Codebeispiel werden zwei Instanzen davon RegionInfo unterschiedlich verglichen.

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.

*/
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.")
      Else
         Console.WriteLine("The two RegionInfo instances are NOT equal.")
      End If 

   End Sub

End Class


'This code produces the following output.
'
'The two RegionInfo instances are equal.

Hinweise

Diese Methode überschreibt Object.Equals.

Gilt für:

Weitere Informationen