CompareInfo.GetCompareInfo CompareInfo.GetCompareInfo CompareInfo.GetCompareInfo CompareInfo.GetCompareInfo Method

Definition

Initialisiert ein neues CompareInfo-Objekt.Initializes a new CompareInfo object.

Überlädt

GetCompareInfo(Int32, Assembly) GetCompareInfo(Int32, Assembly) GetCompareInfo(Int32, Assembly)

Initialisiert ein neues CompareInfo-Objekt, das der angegebenen Kultur zugeordnet ist und Methoden zum Zeichenfolgenvergleich aus der angegebenen Assembly verwendet.Initializes a new CompareInfo object that is associated with the specified culture and that uses string comparison methods in the specified Assembly.

GetCompareInfo(String, Assembly) GetCompareInfo(String, Assembly) GetCompareInfo(String, Assembly)

Initialisiert ein neues CompareInfo-Objekt, das der angegebenen Kultur zugeordnet ist und Methoden zum Zeichenfolgenvergleich aus der angegebenen Assembly verwendet.Initializes a new CompareInfo object that is associated with the specified culture and that uses string comparison methods in the specified Assembly.

GetCompareInfo(Int32) GetCompareInfo(Int32) GetCompareInfo(Int32) GetCompareInfo(Int32)

Initialisiert ein neues CompareInfo-Objekt, das der Kultur mit dem angegebenen Bezeichner zugeordnet ist.Initializes a new CompareInfo object that is associated with the culture with the specified identifier.

GetCompareInfo(String) GetCompareInfo(String) GetCompareInfo(String) GetCompareInfo(String)

Initialisiert ein neues CompareInfo-Objekt, das der Kultur mit dem angegebenen Namen zugeordnet ist.Initializes a new CompareInfo object that is associated with the culture with the specified name.

GetCompareInfo(Int32, Assembly) GetCompareInfo(Int32, Assembly) GetCompareInfo(Int32, Assembly)

Initialisiert ein neues CompareInfo-Objekt, das der angegebenen Kultur zugeordnet ist und Methoden zum Zeichenfolgenvergleich aus der angegebenen Assembly verwendet.Initializes a new CompareInfo object that is associated with the specified culture and that uses string comparison methods in the specified 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

Parameter

culture
Int32 Int32 Int32 Int32

Eine ganze Zahl, die den Kulturbezeichner darstellt.An integer representing the culture identifier.

assembly
Assembly Assembly Assembly Assembly

Eine Assembly, die die für den Zeichenfolgenvergleich zu verwendenden Methoden enthält.An Assembly that contains the string comparison methods to use.

Gibt zurück

Ein neues CompareInfo-Objekt, das der Kultur mit dem angegebenen Bezeichner zugeordnet ist und Methoden zum Zeichenfolgenvergleich aus der aktuellen Assembly verwendet.A new CompareInfo object associated with the culture with the specified identifier and using string comparison methods in the current Assembly.

Ausnahmen

assembly ist ein ungültiger Typ.assembly is of an invalid type.

Hinweise

Hinweis

Das Verhalten dieser Methode ist unvorhersehbar.The behavior of this method is unpredictable. Es wird empfohlen, für Ihre Anwendung eine Version dieser Methode zu verwenden, der keine Assembly Eingabe akzeptiert.It is recommended for your application to use a version of this method that does not take an assembly input.

Die assembly -Parameter muss vom gleichen Typ wie sein Module.Assembly.The assembly parameter must be of the same type as Module.Assembly.

Siehe auch

GetCompareInfo(String, Assembly) GetCompareInfo(String, Assembly) GetCompareInfo(String, Assembly)

Initialisiert ein neues CompareInfo-Objekt, das der angegebenen Kultur zugeordnet ist und Methoden zum Zeichenfolgenvergleich aus der angegebenen Assembly verwendet.Initializes a new CompareInfo object that is associated with the specified culture and that uses string comparison methods in the specified 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

Parameter

name
String String String String

Eine Zeichenfolge, die den Kulturnamen darstellt.A string representing the culture name.

assembly
Assembly Assembly Assembly Assembly

Eine Assembly, die die für den Zeichenfolgenvergleich zu verwendenden Methoden enthält.An Assembly that contains the string comparison methods to use.

Gibt zurück

Ein neues CompareInfo-Objekt, das der Kultur mit dem angegebenen Bezeichner zugeordnet ist und Methoden zum Zeichenfolgenvergleich aus der aktuellen Assembly verwendet.A new CompareInfo object associated with the culture with the specified identifier and using string comparison methods in the current Assembly.

Ausnahmen

name ist null.name is null.

- oder - -or- assembly ist null.assembly is null.

name ist ein ungültiger Kulturname.name is an invalid culture name.

- oder --or- assembly ist ein ungültiger Typ.assembly is of an invalid type.

Hinweise

Hinweis

Das Verhalten dieser Methode ist unvorhersehbar.The behavior of this method is unpredictable. Es wird empfohlen, dass Sie eine Version dieser Methode verwenden, die keine Assembly Eingabe akzeptiert.We recommend that you use a version of this method that does not take an assembly input.

Die assembly -Parameter muss vom gleichen Typ wie sein Module.Assembly.The assembly parameter must be of the same type as Module.Assembly.

Siehe auch

GetCompareInfo(Int32) GetCompareInfo(Int32) GetCompareInfo(Int32) GetCompareInfo(Int32)

Initialisiert ein neues CompareInfo-Objekt, das der Kultur mit dem angegebenen Bezeichner zugeordnet ist.Initializes a new CompareInfo object that is associated with the culture with the specified identifier.

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 Int32 Int32 Int32

Eine ganze Zahl, die den Kulturbezeichner darstellt.An integer representing the culture identifier.

Gibt zurück

Ein neues CompareInfo-Objekt, das der Kultur mit dem angegebenen Bezeichner zugeordnet ist und Methoden zum Zeichenfolgenvergleich aus der aktuellen Assembly verwendet.A new CompareInfo object associated with the culture with the specified identifier and using string comparison methods in the current Assembly.

Beispiele

Im folgenden Beispiel wird die Teile von zwei Zeichenfolgen unter Verwendung der verschiedenen CompareInfo Objekte:The following example compares portions of two strings using the different CompareInfo objects:

// The following code example compares two strings using the different CompareInfo instances:
//    a CompareInfo instance associated with the S"Spanish - Spain" culture with international sort,
//    a CompareInfo instance associated with the S"Spanish - Spain" culture with traditional sort, and
//    a CompareInfo instance associated with the InvariantCulture.
using namespace System;
using namespace System::Globalization;
int main()
{
   
   // Defines the strings to compare.
   String^ myStr1 = "calle";
   String^ myStr2 = "calor";
   
   // Uses GetCompareInfo to create the CompareInfo that 
   // uses the S"es-ES" culture with international sort.
   CompareInfo^ myCompIntl = CompareInfo::GetCompareInfo( "es-ES" );
   
   // Uses GetCompareInfo to create the CompareInfo that 
   // uses the S"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.

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
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 'Main 

End Class 'SamplesCompareInfo


'This code produces the following output.
'
'Comparing "calle" and "calor"
'   With myCompIntl.Compare: -1
'   With myCompTrad.Compare: 1
'   With myCompInva.Compare: -1

GetCompareInfo(String) GetCompareInfo(String) GetCompareInfo(String) GetCompareInfo(String)

Initialisiert ein neues CompareInfo-Objekt, das der Kultur mit dem angegebenen Namen zugeordnet ist.Initializes a new CompareInfo object that is associated with the culture with the specified name.

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 String String String

Eine Zeichenfolge, die den Kulturnamen darstellt.A string representing the culture name.

Gibt zurück

Ein neues CompareInfo-Objekt, das der Kultur mit dem angegebenen Bezeichner zugeordnet ist und Methoden zum Zeichenfolgenvergleich aus der aktuellen Assembly verwendet.A new CompareInfo object associated with the culture with the specified identifier and using string comparison methods in the current Assembly.

Ausnahmen

name ist ein ungültiger Kulturname.name is an invalid culture name.

Beispiele

Im folgenden Beispiel wird die Teile von zwei Zeichenfolgen unter Verwendung der verschiedenen CompareInfo Objekte:The following example compares portions of two strings using the different CompareInfo objects:

// The following code example compares two strings using the different CompareInfo instances:
//    a CompareInfo instance associated with the S"Spanish - Spain" culture with international sort,
//    a CompareInfo instance associated with the S"Spanish - Spain" culture with traditional sort, and
//    a CompareInfo instance associated with the InvariantCulture.
using namespace System;
using namespace System::Globalization;
int main()
{
   
   // Defines the strings to compare.
   String^ myStr1 = "calle";
   String^ myStr2 = "calor";
   
   // Uses GetCompareInfo to create the CompareInfo that 
   // uses the S"es-ES" culture with international sort.
   CompareInfo^ myCompIntl = CompareInfo::GetCompareInfo( "es-ES" );
   
   // Uses GetCompareInfo to create the CompareInfo that 
   // uses the S"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.

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
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 'Main 

End Class 'SamplesCompareInfo


'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: