Thursday, April 2, 2009

incomparably simple compare to example because I can never remember


using System;

class Program
{
static void Main()
{
string a = "a"; // 1
string b = "b"; // 2

int c = 0;

// When a is SMALLER than b
c = a.CompareTo(b);
Console.WriteLine(c);
// -1

// When b is BIGGER than a
c = b.CompareTo(a);
Console.WriteLine(c);
// 1
}
}

No comments: