RegionInfo.Equals(Object) メソッド
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
指定したオブジェクトが現在の RegionInfoと同じインスタンスであるかどうかを判断します。
public:
override bool Equals(System::Object ^ value);
public override bool Equals(object value);
public override bool Equals(object? value);
override this.Equals : obj -> bool
Public Overrides Function Equals (value As Object) As Boolean
パラメーター
- value
- Object
現在の RegionInfoと比較するオブジェクト。
返品
true
value パラメーターがRegionInfo オブジェクトであり、そのNameプロパティが現在のName オブジェクトのRegionInfo プロパティと同じである場合はfalse。
例
次のコード例では、異なる方法で作成された RegionInfo の 2 つのインスタンスを比較します。
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.
注釈
このメソッドは、Object.Equals をオーバーライドします。