CompareInfo.GetCompareInfo Methode
Definition
Wichtig
Einige Informationen beziehen sich auf Vorabversionen, die vor dem Release ggf. grundlegend überarbeitet werden. Microsoft übernimmt hinsichtlich der hier bereitgestellten Informationen keine Gewährleistungen, seien sie ausdrücklich oder konkludent.
Initialisiert ein neues CompareInfo Objekt.
Überlädt
| Name | Beschreibung |
|---|---|
| GetCompareInfo(String, Assembly) |
Initialisiert ein neues CompareInfo Objekt, das der angegebenen Kultur zugeordnet ist, und verwendet Zeichenfolgenvergleichsmethoden in der angegebenen .Assembly |
| GetCompareInfo(Int32, Assembly) |
Initialisiert ein neues CompareInfo Objekt, das der angegebenen Kultur zugeordnet ist, und verwendet Zeichenfolgenvergleichsmethoden in der angegebenen .Assembly |
| GetCompareInfo(Int32) |
Initialisiert ein neues CompareInfo Objekt, das der Kultur mit dem angegebenen Bezeichner zugeordnet ist. |
| GetCompareInfo(String) |
Initialisiert ein neues CompareInfo Objekt, das der Kultur mit dem angegebenen Namen zugeordnet ist. |
GetCompareInfo(String, Assembly)
Initialisiert ein neues CompareInfo Objekt, das der angegebenen Kultur zugeordnet ist, und verwendet Zeichenfolgenvergleichsmethoden in der angegebenen .Assembly
public:
static System::Globalization::CompareInfo ^ GetCompareInfo(System::String ^ name, System::Reflection::Assembly ^ assembly);
public static System.Globalization.CompareInfo GetCompareInfo(string name, System.Reflection.Assembly assembly);
static member GetCompareInfo : string * System.Reflection.Assembly -> System.Globalization.CompareInfo
Public Shared Function GetCompareInfo (name As String, assembly As Assembly) As CompareInfo
Parameter
- name
- String
Eine Zeichenfolge, die den Kulturnamen darstellt.
Gibt zurück
Ein neues CompareInfo Objekt, das der Kultur mit dem angegebenen Bezeichner zugeordnet ist und Zeichenfolgenvergleichsmethoden im aktuellen AssemblyVerwendet.
Ausnahmen
Hinweise
Note
Das Verhalten dieser Methode ist unvorhersehbar. Es wird empfohlen, eine Version dieser Methode zu verwenden, die keine Assemblyeingabe verwendet.
Der assembly Parameter muss denselben Typ aufweisen wie Module.Assembly.
Weitere Informationen
Gilt für:
GetCompareInfo(Int32, Assembly)
Initialisiert ein neues CompareInfo Objekt, das der angegebenen Kultur zugeordnet ist, und verwendet Zeichenfolgenvergleichsmethoden in der angegebenen .Assembly
public:
static System::Globalization::CompareInfo ^ GetCompareInfo(int culture, System::Reflection::Assembly ^ assembly);
public static System.Globalization.CompareInfo GetCompareInfo(int culture, System.Reflection.Assembly assembly);
static member GetCompareInfo : int * System.Reflection.Assembly -> System.Globalization.CompareInfo
Public Shared Function GetCompareInfo (culture As Integer, assembly As Assembly) As CompareInfo
Parameter
- culture
- Int32
Eine ganze Zahl, die den Kulturbezeichner darstellt.
Gibt zurück
Ein neues CompareInfo Objekt, das der Kultur mit dem angegebenen Bezeichner zugeordnet ist und Zeichenfolgenvergleichsmethoden im aktuellen AssemblyVerwendet.
Ausnahmen
assembly ist null.
assembly ist von einem ungültigen Typ.
Hinweise
Note
Das Verhalten dieser Methode ist unvorhersehbar. Es wird empfohlen, dass Ihre Anwendung eine Version dieser Methode verwendet, die keine Assemblyeingabe verwendet.
Der assembly Parameter muss denselben Typ aufweisen wie Module.Assembly.
Weitere Informationen
Gilt für:
GetCompareInfo(Int32)
Initialisiert ein neues CompareInfo Objekt, das der Kultur mit dem angegebenen Bezeichner zugeordnet ist.
public:
static System::Globalization::CompareInfo ^ GetCompareInfo(int culture);
public static System.Globalization.CompareInfo GetCompareInfo(int culture);
static member GetCompareInfo : int -> System.Globalization.CompareInfo
Public Shared Function GetCompareInfo (culture As Integer) As CompareInfo
Parameter
- culture
- Int32
Eine ganze Zahl, die den Kulturbezeichner darstellt.
Gibt zurück
Ein neues CompareInfo Objekt, das der Kultur mit dem angegebenen Bezeichner zugeordnet ist und Zeichenfolgenvergleichsmethoden im aktuellen AssemblyVerwendet.
Beispiele
Im folgenden Beispiel werden Teile von zwei Zeichenfolgen mit den verschiedenen CompareInfo Objekten verglichen:
CompareInfo Objekt, das der spanischen Kultur (Spanien) mit internationaler Sortierung zugeordnet ist
CompareInfo Objekt, das der spanischen Kultur (Spanien) mit der traditionellen Sortierung zugeordnet ist
CompareInfo objekt zugeordnet mit dem InvariantCulture
// The following code example compares two strings using the different CompareInfo instances:
// a CompareInfo instance associated with the "Spanish - Spain" culture with international sort,
// a CompareInfo instance associated with the "Spanish - Spain" culture with traditional sort, and
// a CompareInfo instance associated with the InvariantCulture.
using System;
using System.Globalization;
public class SamplesCompareInfo {
public static void Main() {
// Defines the strings to compare.
String myStr1 = "calle";
String myStr2 = "calor";
// Uses GetCompareInfo to create the CompareInfo that uses the "es-ES" culture with international sort.
CompareInfo myCompIntl = CompareInfo.GetCompareInfo( "es-ES" );
// Uses GetCompareInfo to create the CompareInfo that uses the "es-ES" culture with traditional sort.
CompareInfo myCompTrad = CompareInfo.GetCompareInfo( 0x040A );
// Uses the CompareInfo property of the InvariantCulture.
CompareInfo myCompInva = CultureInfo.InvariantCulture.CompareInfo;
// Compares two strings using myCompIntl.
Console.WriteLine( "Comparing \"{0}\" and \"{1}\"", myStr1, myStr2 );
Console.WriteLine( " With myCompIntl.Compare: {0}", myCompIntl.Compare( myStr1, myStr2 ) );
Console.WriteLine( " With myCompTrad.Compare: {0}", myCompTrad.Compare( myStr1, myStr2 ) );
Console.WriteLine( " With myCompInva.Compare: {0}", myCompInva.Compare( myStr1, myStr2 ) );
}
}
/*
This code produces the following output.
Comparing "calle" and "calor"
With myCompIntl.Compare: -1
With myCompTrad.Compare: 1
With myCompInva.Compare: -1
*/
' The following code example compares two strings using the different CompareInfo instances:
' a CompareInfo instance associated with the "Spanish - Spain" culture with international sort,
' a CompareInfo instance associated with the "Spanish - Spain" culture with traditional sort, and
' a CompareInfo instance associated with the InvariantCulture.
Imports System.Globalization
Public Class SamplesCompareInfo
Public Shared Sub Main()
' Defines the strings to compare.
Dim myStr1 As [String] = "calle"
Dim myStr2 As [String] = "calor"
' Uses GetCompareInfo to create the CompareInfo that uses the "es-ES" culture with international sort.
Dim myCompIntl As CompareInfo = CompareInfo.GetCompareInfo("es-ES")
' Uses GetCompareInfo to create the CompareInfo that uses the "es-ES" culture with traditional sort.
Dim myCompTrad As CompareInfo = CompareInfo.GetCompareInfo(&H40A)
' Uses the CompareInfo property of the InvariantCulture.
Dim myCompInva As CompareInfo = CultureInfo.InvariantCulture.CompareInfo
' Compares two strings using myCompIntl.
Console.WriteLine("Comparing ""{0}"" and ""{1}""", myStr1, myStr2)
Console.WriteLine(" With myCompIntl.Compare: {0}", myCompIntl.Compare(myStr1, myStr2))
Console.WriteLine(" With myCompTrad.Compare: {0}", myCompTrad.Compare(myStr1, myStr2))
Console.WriteLine(" With myCompInva.Compare: {0}", myCompInva.Compare(myStr1, myStr2))
End Sub
End Class
'This code produces the following output.
'
'Comparing "calle" and "calor"
' With myCompIntl.Compare: -1
' With myCompTrad.Compare: 1
' With myCompInva.Compare: -1
Gilt für:
GetCompareInfo(String)
Initialisiert ein neues CompareInfo Objekt, das der Kultur mit dem angegebenen Namen zugeordnet ist.
public:
static System::Globalization::CompareInfo ^ GetCompareInfo(System::String ^ name);
public static System.Globalization.CompareInfo GetCompareInfo(string name);
static member GetCompareInfo : string -> System.Globalization.CompareInfo
Public Shared Function GetCompareInfo (name As String) As CompareInfo
Parameter
- name
- String
Eine Zeichenfolge, die den Kulturnamen darstellt.
Gibt zurück
Ein neues CompareInfo Objekt, das der Kultur mit dem angegebenen Bezeichner zugeordnet ist und Zeichenfolgenvergleichsmethoden im aktuellen AssemblyVerwendet.
Ausnahmen
name ist null.
name ist ein ungültiger Kulturname.
Beispiele
Im folgenden Beispiel werden Teile von zwei Zeichenfolgen mit den verschiedenen CompareInfo Objekten verglichen:
CompareInfo Objekt, das der spanischen Kultur (Spanien) mit internationaler Sortierung zugeordnet ist
CompareInfo Objekt, das der spanischen Kultur (Spanien) mit der traditionellen Sortierung zugeordnet ist
CompareInfo objekt zugeordnet mit dem InvariantCulture
// The following code example compares two strings using the different CompareInfo instances:
// a CompareInfo instance associated with the "Spanish - Spain" culture with international sort,
// a CompareInfo instance associated with the "Spanish - Spain" culture with traditional sort, and
// a CompareInfo instance associated with the InvariantCulture.
using System;
using System.Globalization;
public class SamplesCompareInfo {
public static void Main() {
// Defines the strings to compare.
String myStr1 = "calle";
String myStr2 = "calor";
// Uses GetCompareInfo to create the CompareInfo that uses the "es-ES" culture with international sort.
CompareInfo myCompIntl = CompareInfo.GetCompareInfo( "es-ES" );
// Uses GetCompareInfo to create the CompareInfo that uses the "es-ES" culture with traditional sort.
CompareInfo myCompTrad = CompareInfo.GetCompareInfo( 0x040A );
// Uses the CompareInfo property of the InvariantCulture.
CompareInfo myCompInva = CultureInfo.InvariantCulture.CompareInfo;
// Compares two strings using myCompIntl.
Console.WriteLine( "Comparing \"{0}\" and \"{1}\"", myStr1, myStr2 );
Console.WriteLine( " With myCompIntl.Compare: {0}", myCompIntl.Compare( myStr1, myStr2 ) );
Console.WriteLine( " With myCompTrad.Compare: {0}", myCompTrad.Compare( myStr1, myStr2 ) );
Console.WriteLine( " With myCompInva.Compare: {0}", myCompInva.Compare( myStr1, myStr2 ) );
}
}
/*
This code produces the following output.
Comparing "calle" and "calor"
With myCompIntl.Compare: -1
With myCompTrad.Compare: 1
With myCompInva.Compare: -1
*/
' The following code example compares two strings using the different CompareInfo instances:
' a CompareInfo instance associated with the "Spanish - Spain" culture with international sort,
' a CompareInfo instance associated with the "Spanish - Spain" culture with traditional sort, and
' a CompareInfo instance associated with the InvariantCulture.
Imports System.Globalization
Public Class SamplesCompareInfo
Public Shared Sub Main()
' Defines the strings to compare.
Dim myStr1 As [String] = "calle"
Dim myStr2 As [String] = "calor"
' Uses GetCompareInfo to create the CompareInfo that uses the "es-ES" culture with international sort.
Dim myCompIntl As CompareInfo = CompareInfo.GetCompareInfo("es-ES")
' Uses GetCompareInfo to create the CompareInfo that uses the "es-ES" culture with traditional sort.
Dim myCompTrad As CompareInfo = CompareInfo.GetCompareInfo(&H40A)
' Uses the CompareInfo property of the InvariantCulture.
Dim myCompInva As CompareInfo = CultureInfo.InvariantCulture.CompareInfo
' Compares two strings using myCompIntl.
Console.WriteLine("Comparing ""{0}"" and ""{1}""", myStr1, myStr2)
Console.WriteLine(" With myCompIntl.Compare: {0}", myCompIntl.Compare(myStr1, myStr2))
Console.WriteLine(" With myCompTrad.Compare: {0}", myCompTrad.Compare(myStr1, myStr2))
Console.WriteLine(" With myCompInva.Compare: {0}", myCompInva.Compare(myStr1, myStr2))
End Sub
End Class
'This code produces the following output.
'
'Comparing "calle" and "calor"
' With myCompIntl.Compare: -1
' With myCompTrad.Compare: 1
' With myCompInva.Compare: -1