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

정의

CompareInfo 개체를 초기화합니다.Initializes a new CompareInfo object.

오버로드

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

지정된 문화권과 연결되어 있고 지정된 CompareInfo의 문자열 비교 메서드를 사용하는 새 Assembly 개체를 초기화합니다.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)

지정된 문화권과 연결되어 있고 지정된 CompareInfo의 문자열 비교 메서드를 사용하는 새 Assembly 개체를 초기화합니다.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)

지정된 식별자가 있는 문화권과 연결된 새 CompareInfo 개체를 초기화합니다.Initializes a new CompareInfo object that is associated with the culture with the specified identifier.

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

지정된 이름이 있는 문화권과 연결된 새 CompareInfo 개체를 초기화합니다.Initializes a new CompareInfo object that is associated with the culture with the specified name.

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

지정된 문화권과 연결되어 있고 지정된 CompareInfo의 문자열 비교 메서드를 사용하는 새 Assembly 개체를 초기화합니다.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

매개 변수

culture
Int32 Int32 Int32 Int32

문화권 식별자를 나타내는 정수입니다.An integer representing the culture identifier.

assembly
Assembly Assembly Assembly Assembly

사용할 문자열 비교 메서드가 들어 있는 Assembly입니다.An Assembly that contains the string comparison methods to use.

반환

지정된 식별자가 있는 문화권과 연결되어 있고 현재 CompareInfo의 문자열 비교 메서드를 사용하는 새 Assembly 개체입니다.A new CompareInfo object associated with the culture with the specified identifier and using string comparison methods in the current Assembly.

예외

assembly가 잘못된 형식인 경우assembly is of an invalid type.

설명

참고

이 메서드의 동작은 예측할 수 없습니다.The behavior of this method is unpredictable. 어셈블리를 입력 하지 않는이 메서드의 버전을 사용 하도록 응용 프로그램에 대 한 것이 좋습니다.It is recommended for your application to use a version of this method that does not take an assembly input.

합니다 assembly 와 동일한 형식 매개 변수 이어야 Module.Assembly합니다.The assembly parameter must be of the same type as Module.Assembly.

추가 정보

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

지정된 문화권과 연결되어 있고 지정된 CompareInfo의 문자열 비교 메서드를 사용하는 새 Assembly 개체를 초기화합니다.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

매개 변수

name
String String String String

문화권 이름을 나타내는 문자열입니다.A string representing the culture name.

assembly
Assembly Assembly Assembly Assembly

사용할 문자열 비교 메서드가 들어 있는 Assembly입니다.An Assembly that contains the string comparison methods to use.

반환

지정된 식별자가 있는 문화권과 연결되어 있고 현재 CompareInfo의 문자열 비교 메서드를 사용하는 새 Assembly 개체입니다.A new CompareInfo object associated with the culture with the specified identifier and using string comparison methods in the current Assembly.

예외

namenull입니다.name is null.

또는-or- assemblynull입니다.assembly is null.

name이 잘못된 문화권 이름인 경우name is an invalid culture name.

또는-or- assembly가 잘못된 형식인 경우assembly is of an invalid type.

설명

참고

이 메서드의 동작은 예측할 수 없습니다.The behavior of this method is unpredictable. 어셈블리를 입력 하지 않는이 메서드의 버전을 사용 하는 것이 좋습니다.We recommend that you use a version of this method that does not take an assembly input.

합니다 assembly 와 동일한 형식 매개 변수 이어야 Module.Assembly합니다.The assembly parameter must be of the same type as Module.Assembly.

추가 정보

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

지정된 식별자가 있는 문화권과 연결된 새 CompareInfo 개체를 초기화합니다.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

매개 변수

culture
Int32 Int32 Int32 Int32

문화권 식별자를 나타내는 정수입니다.An integer representing the culture identifier.

반환

지정된 식별자가 있는 문화권과 연결되어 있고 현재 CompareInfo의 문자열 비교 메서드를 사용하는 새 Assembly 개체입니다.A new CompareInfo object associated with the culture with the specified identifier and using string comparison methods in the current Assembly.

예제

다음 예제에서는 다양 한를 사용 하 여 두 문자열의 일부를 비교 CompareInfo 개체:The following example compares portions of two strings using the different CompareInfo objects:

  • CompareInfo 국제 정렬을 사용 하 여 스페인어 (스페인) 문화권을 사용 하 여 연결 된 개체CompareInfo object associated with the Spanish (Spain) culture with international sort

  • CompareInfo 전통 정렬을 사용 하 여 스페인어 (스페인) 문화권을 사용 하 여 연결 된 개체CompareInfo object associated with the Spanish (Spain) culture with traditional sort

  • CompareInfo 연결 된 개체는 InvariantCultureCompareInfo object associated with the InvariantCulture

// 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)

지정된 이름이 있는 문화권과 연결된 새 CompareInfo 개체를 초기화합니다.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

매개 변수

name
String String String String

문화권 이름을 나타내는 문자열입니다.A string representing the culture name.

반환

지정된 식별자가 있는 문화권과 연결되어 있고 현재 CompareInfo의 문자열 비교 메서드를 사용하는 새 Assembly 개체입니다.A new CompareInfo object associated with the culture with the specified identifier and using string comparison methods in the current Assembly.

예외

name이 잘못된 문화권 이름인 경우name is an invalid culture name.

예제

다음 예제에서는 다양 한를 사용 하 여 두 문자열의 일부를 비교 CompareInfo 개체:The following example compares portions of two strings using the different CompareInfo objects:

  • CompareInfo 국제 정렬을 사용 하 여 스페인어 (스페인) 문화권을 사용 하 여 연결 된 개체CompareInfo object associated with the Spanish (Spain) culture with international sort

  • CompareInfo 전통 정렬을 사용 하 여 스페인어 (스페인) 문화권을 사용 하 여 연결 된 개체CompareInfo object associated with the Spanish (Spain) culture with traditional sort

  • CompareInfo 연결 된 개체는 InvariantCultureCompareInfo object associated with the InvariantCulture

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

적용 대상