static void PrintGameObjectSameNum(GameObject go, int max) { Dictionary <string, int> counts = new Dictionary <string, int>(); CountGameObjectByName(go.transform, counts); List <KeyValuePair <string, int> > ret = HelpFunc.SortDicitionary(counts, (a1, a2) => { return(a2.Value.CompareTo(a1.Value)); }); string filePath = Application.dataPath + "/" + go.name + ".txt"; if (File.Exists(filePath)) { File.Delete(filePath); } int count = 0; foreach (KeyValuePair <string, int> element in ret) { if (element.Value > max) { count += element.Value; Utils.FileWrite(filePath, string.Format("{0}:{1}", element.Key, element.Value)); } } Utils.FileWrite(filePath, "total:" + count.ToString()); }
static void Main(string[] args) { int[] array = HelpFunc.GetRandomArray(50); HelpFunc.PrintArray(array); Console.WriteLine(); HelpFunc.PrintArray(SelectionSort(array)); Console.ReadKey(); }