public void SortSayingTest( ) { GameSaying.LoadSayings( ); GameSaying.Sayings.Sort((x, y) => { int contentLenthDiff = x.ContentLenth - y.ContentLenth; if (contentLenthDiff == 0) { int lenthDiff = x.ToXElement( ).ToString( ).Length - y.ToXElement( ).ToString( ).Length; if (lenthDiff == 0) { return(string.CompareOrdinal(x.Content, y.Content)); } return(lenthDiff); } return(contentLenthDiff); }); string lastSaying = string.Empty; foreach (GameSaying saying in GameSaying.Sayings) { if (saying.Content != lastSaying) { Console.WriteLine(saying.ToXElement( )); lastSaying = saying.Content; } } }
public void LoadSayingTest( ) { GameSaying.LoadSayings( ); }