Freigeben über


RegionInfo.Equals-Methode

Bestimmt, ob es sich bei dem angegebenen Objekt um dieselbe Instanz handelt wie die aktuelle RegionInfo.

Overrides Public Function Equals( _
   ByVal value As Object _) As Boolean
[C#]
public override bool Equals(objectvalue);
[C++]
public: bool Equals(Object* value);
[JScript]
public override function Equals(
   value : Object) : Boolean;

Parameter

  • value
    Das Objekt, das mit der aktuellen RegionInfo verglichen werden soll.

Rückgabewert

true, wenn value dieselbe Instanz wie die aktuelle RegionInfo ist, andernfalls false.

Hinweise

Diese Methode überschreibt Object.Equals.

Beispiel

[Visual Basic, C#, C++] Im folgenden Codebeispiel werden zwei unterschiedlich erstellte Instanzen von RegionInfo verglichen.

 
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.")
      Else
         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.



[C#] 
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.

*/

[C++] 
#using <mscorlib.dll>
using namespace System;
using namespace System::Globalization;

int main()  {

   // Creates a RegionInfo using the ISO 3166 two-letter code.
   RegionInfo* myRI1 = new RegionInfo( S"US" );

   // Creates a RegionInfo using a CultureInfo.LCID.
   RegionInfo* myRI2 = new RegionInfo( (new CultureInfo(S"en-US",false))->LCID );

   // Compares the two instances.
   if ( myRI1->Equals( myRI2 ) )
      Console::WriteLine( S"The two RegionInfo instances are equal." );
   else
      Console::WriteLine( S"The two RegionInfo instances are NOT equal." );

}

/*
This code produces the following output.

The two RegionInfo instances are equal.

*/

[JScript] Für JScript ist kein Beispiel verfügbar. Klicken Sie zum Anzeigen eines Beispiels für Visual Basic, C# oder C++ in der linken oberen Ecke der Seite auf die Schaltfläche "Sprachfilter" Sprachfilter.

Anforderungen

Plattformen: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003-Familie, .NET Compact Framework - Windows CE .NET

Siehe auch

RegionInfo-Klasse | RegionInfo-Member | System.Globalization-Namespace | Object.Equals