bool IsAnagram(string str1, string str2)
{
// Lengths must match
if( str1.Length != str2.Length )
return false;
// Make character arrays
char[] chars_1 = str1.ToCharArray();
char[] chars_2 = str2.ToCharArray();
// Sort em
Array.Sort(chars_1);
Array.Sort(chars_2);
// See if they're arrays
for( int i = 0; i < chars_1.Length; i++ )
if( chars_1[i] != chars_2[i] )
return false;
// Yep.
return true;
}