public static void SaveNewScore(int score) { var appReader = new ApplicationDataReader <HighScoreData>(); var highScoreData = appReader.LoadData(highScoreDataFilePath); if (highScoreData != null) { var scores = highScoreData.GetScores(); for (int i = 0; i < scores.Length; i++) { if (score > scores[i]) { scores[i] = score; break; } } highScoreData.SetScores(scores.OrderByDescending(x => x).ToArray()); } else { var scores = new int[10]; scores[0] = score; highScoreData = new HighScoreData(); highScoreData.SetScores(scores); } appReader.SaveData(highScoreData, highScoreDataFilePath); }