Snippets

Cameron Presley Bjxoy: Untitled snippet

Created by Cameron Presley
void Main()
{
	var list = new List<string>{"1_to_2", "0_to_1", "10_to_11", "3_to_4", "5_to_6", "4_to_5", "2_to_3"};
	list.Sort(LessThan);
	list.Dump();
}

public int LessThan(string first, string second)
{
	var firstInt = Int32.Parse(GetFirstBit(first));
	var secondInt = Int32.Parse(GetFirstBit(second));
	
	if (firstInt == secondInt) return 0;
	if (firstInt < secondInt) return -1;
	return 1;
}

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.