Compare

두 값 중 하나가 다른 값보다 "큰지, 작은지, 같은지" 여부를 비교.

두 bool 값을 비교하기 위한 버전.

int Compare(
   const bool  x,         // 첫 번째 값
   const bool  y          // 두 번째 값
   );

두 char 값을 비교하는 버전.

int Compare(
   const char  x,         // 첫 번째 값
   const char  y          // 두 번째 값
   );

두 개의 uchar 값을 비교하는 버전.

int Compare(
   const uchar  x,        // 첫 번째 값
   const uchar  y         // 두 버째 값
   );

두 개의 short 값을 비교하는 버전.

int Compare(
   const short  x,        // 첫 번째 값
   const short  y         // 두 번째 값
   );

두 가지 ushort 값을 비교하기 위한 위한 버전.

int Compare(
   const ushort  x,       // 첫 번째 값
   const ushort  y        // 두 번째 값
   );

두 색상 값을 비교하는 버전.

int Compare(
   const color  x,        // 첫 번째 값
   const color  y         // 두 번째 값
   );

두 int 값을 비교하는 버전.

int Compare(
   const int  x,          // 첫 번째 값
   const int  y           // 두 번째 값
   );

두 uint 값을 비교하는 버전.

int Compare(
   const uint  x,         // 첫 번째 값
   const uint  y          // 두 번째 값
   );

두 datetime 값을 비교하는 버전.

int Compare(
   const datetime  x,     // 첫 번째 값
   const datetime  y      // 두 번째 값
   );

두 개의 long 값을 비교하는 버전.

int Compare(
   const long  x,         // 첫 번째 값
   const long  y          // 두 번째 값
   );

두 ulong 값을 비교하는 버전.

int Compare(
   const ulong  x,        // 첫 번째 값
   const ulong  y         // 두 번째 값
   );

두 float 값을 비교하는 버전.

int Compare(
   const float  x,        // 첫 번째 값
   const float  y         // 두 번째 값
   );

두 double 값을 비교하는 버전.

int Compare(
   const double  x,       // 첫 번째 값
   const double  y        // 두 번째 값
   );

두 문자열 값을 비교하는 버전.

int Compare(
   const string  x,       // 첫 번째 값
   const string  y        // 두 번째 값
   );

다른 유형의 두 값을 비교하는 버전.

template<typename T>
int Compare(
    x,                  // 첫 번째 값
    y                   // 두 번째 값
   );

매개변수

x

[in]  첫 번째 값

y

[in]  두 번째 값

값 반환

비교된 두 값의 비율을 나타내는 숫자를 반환:

  • 결과가 0보다 작으면, x가 y보다 작음 (x<y)
  • 결과가 0이면, x가 y와 같음 (x=y)
  • 결과가 0보다 크면, x가 y보다 큼 (x>y)

참고

만약 T 유형이 IComparable<T> 인터페이스를 구현하는 개체라면, 그 개체들은 Compare 메서드를 기반으로 비교될 것입니다. 다른 모든 경우에 0이 반환됩니다.