GlobalizationExtensions.GetStringComparer(CompareInfo, CompareOptions) 方法

定义

根据指定 StringComparer 对象区分区域性的字符串比较规则,返回 CompareInfo 对象。Returns a StringComparer object based on the culture-sensitive string comparison rules of a specified CompareInfo object.

public:
[System::Runtime::CompilerServices::Extension]
 static StringComparer ^ GetStringComparer(System::Globalization::CompareInfo ^ compareInfo, System::Globalization::CompareOptions options);
public static StringComparer GetStringComparer (this System.Globalization.CompareInfo compareInfo, System.Globalization.CompareOptions options);
static member GetStringComparer : System.Globalization.CompareInfo * System.Globalization.CompareOptions -> StringComparer

参数

compareInfo
CompareInfo

一个对象,该对象支持区分区域性的字符串比较。An object that supports culture-sensitive string comparison.

options
CompareOptions

一个值,用于定义应如何比较字符串。A value that defines how strings should be compared. options 可以是枚举值 OrdinalOrdinalIgnoreCase,也可以是以下一个或多个值的按位组合:IgnoreCaseIgnoreSymbolsIgnoreNonSpaceIgnoreWidthIgnoreKanaTypeStringSortoptions is either the enumeration value Ordinal, the enumeration value OrdinalIgnoreCase, or a bitwise combination of one or more of the following values: IgnoreCase, IgnoreSymbols, IgnoreNonSpace, IgnoreWidth, IgnoreKanaType, and StringSort.

返回

可用于执行字符串比较的对象。An object that can be used to perform string comparisons.

异常

compareInfonullcompareInfo is null.

options 无效。options is invalid.

适用于