CompareInfo.ToString 方法

定義

傳回表示目前 CompareInfo 物件的字串。Returns a string that represents the current CompareInfo object.

public:
 override System::String ^ ToString();
public override string ToString ();
override this.ToString : unit -> string
Public Overrides Function ToString () As String

傳回

String

代表目前 CompareInfo 物件的字串。A string that represents the current CompareInfo object.

備註

這個方法會覆寫 Object.ToString 方法。This method overrides the Object.ToString method. 它會傳回包含類別名稱的字串,以及實例屬性的值 Name (以連字號分隔)。It returns a string that consists of the class name and the value of the instance Name property, separated by a hyphen.

給呼叫者的注意事項

開始使用 .NET Framework 4 時,方法會傳回 ToString() 類別名稱,後面接著空格、連字號、空格和屬性的值 NameStaring with the .NET Framework 4, the ToString() method returns the class name followed by a space, a hyphen, a space, and the value of the Name property. 例如,對於 CompareInfo 代表 en-us 文化特性的物件,此方法會傳回 ToString() ">cultureinfo.invariantculture-en-us"。For example, for a CompareInfo object that represents the en-US culture, the ToString() method returns "CompareInfo - en-US". 在舊版的 .NET Framework 中,它會傳回類別名稱,後面接著空格、連字號、空格和屬性的值 LCIDIn previous versions of the .NET Framework, it returns the class name followed by a space, a hyphen, a space, and the value of the LCID property. 例如,對於 CompareInfo 代表 en-us 文化特性的物件,此方法會傳回 ToString() ">cultureinfo.invariantculture-1033"。For example, for a CompareInfo object that represents the en-US culture, the ToString() method returns "CompareInfo - 1033".

適用於

另請參閱