1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 using System.Threading.Tasks; 6 7 namespace ConsoleApplication6 8 { 9 public class Num 10 { 11 public string Name { get; set; } 12 public string Number { get; set; } 13 public int Row { get; set; } 14 15 public string Note { get; set; } 16 } 17 18 class Program 19 { 20 static void Main(string[] args) 21 { 22 Console.ForegroundColor = ConsoleColor.Green; 23 Console.Write("第一批 "); 24 Console.ForegroundColor = ConsoleColor.Yellow; 25 Console.Write("第二批 "); 26 Console.ForegroundColor = ConsoleColor.Red; 27 Console.Write("第三批 "); 28 Console.WriteLine(""); 29 List<Num> Num = new List<Num>(); 30 Num.Add(new Num { Number = "555", Row = 1 }); 31 Num.Add(new Num { Number = "000", Row = 1 }); 32 Num.Add(new Num { Number = "001", Row = 1 }); 33 Num.Add(new Num { Number = "008", Row = 1 }); 34 Num.Add(new Num { Number = "010", Row = 1 }); 35 Num.Add(new Num { Number = "777", Row = 1 }); 36 Num.Add(new Num { Number = "222", Row = 1 }); 37 Num.Add(new Num { Number = "188", Row = 1 }); 38 Num.Add(new Num { Number = "999", Row = 1 }); 39 Num.Add(new Num { Number = "101", Row = 1 }); 40 Num.Add(new Num { Number = "006", Row = 1 }); 41 Num.Add(new Num { Number = "119", Row = 1 }); 42 Num.Add(new Num { Number = "016", Row = 1 }); 43 Num.Add(new Num { Number = "009", Row = 1 }); 44 Num.Add(new Num { Number = "699", Row = 1 }); 45 Num.Add(new Num { Number = "066", Row = 1 }); 46 Num.Add(new Num { Number = "003", Row = 1 }); 47 Num.Add(new Num { Number = "316", Row = 1 }); 48 Num.Add(new Num { Number = "610", Row = 1 }); 49 Num.Add(new Num { Number = "007", Row = 1 }); 50 Num.Add(new Num { Number = "021", Row = 1 }); 51 Num.Add(new Num { Number = "888", Row = 1 }); 52 Num.Add(new Num { Number = "096", Row = 1 }); 53 Num.Add(new Num { Number = "111", Row = 1 }); 54 Num.Add(new Num { Number = "035", Row = 1 }); 55 Num.Add(new Num { Number = "666", Row = 1 }); 56 Num.Add(new Num { Number = "002", Row = 1 }); 57 Num.Add(new Num { Number = "430", Row = 1 }); 58 Num.Add(new Num { Number = "128", Row = 1 }); 59 Num.Add(new Num { Number = "123", Row = 1 }); 60 Num.Add(new Num { Number = "005", Row = 1 }); 61 Num.Add(new Num { Number = "923", Row = 1 }); 62 Num.Add(new Num { Number = "077", Row = 1 }); 63 64 65 66 Num.Add(new Num { Number = "522", Row = 1 }); 67 Num.Add(new Num { Number = "234", Row = 1 }); 68 Num.Add(new Num { Number = "628", Row = 1 }); 69 Num.Add(new Num { Number = "223", Row = 1 }); 70 Num.Add(new Num { Number = "227", Row = 1 }); 71 Num.Add(new Num { Number = "966", Row = 1 }); 72 Num.Add(new Num { Number = "512", Row = 1 }); 73 Num.Add(new Num { Number = "099", Row = 1 }); 74 Num.Add(new Num { Number = "567", Row = 1 }); 75 Num.Add(new Num { Number = "333", Row = 1 }); 76 Num.Add(new Num { Number = "095", Row = 1 }); 77 Num.Add(new Num { Number = "088", Row = 1 }); 78 Num.Add(new Num { Number = "129", Row = 1 }); 79 Num.Add(new Num { Number = "019", Row = 1 }); 80 Num.Add(new Num { Number = "917", Row = 1 }); 81 Num.Add(new Num { Number = "127", Row = 1 }); 82 Num.Add(new Num { Number = "862", Row = 1 }); 83 Num.Add(new Num { Number = "318", Row = 1 }); 84 Num.Add(new Num { Number = "519", Row = 1 }); 85 Num.Add(new Num { Number = "213", Row = 1 }); 86 Num.Add(new Num { Number = "830", Row = 1 }); 87 Num.Add(new Num { Number = "688", Row = 1 }); 88 Num.Add(new Num { Number = "910", Row = 1 }); 89 Num.Add(new Num { Number = "168", Row = 1 }); 90 Num.Add(new Num { Number = "518", Row = 1 }); 91 Num.Add(new Num { Number = "823", Row = 1 }); 92 Num.Add(new Num { Number = "110", Row = 1 }); 93 94 Num.Add(new Num { Number = "166", Row = 2 }); 95 Num.Add(new Num { Number = "808", Row = 2 }); 96 Num.Add(new Num { Number = "410", Row = 2 }); 97 Num.Add(new Num { Number = "818", Row = 2 }); 98 Num.Add(new Num { Number = "789", Row = 2 }); 99 Num.Add(new Num { Number = "728", Row = 2 }); 100 Num.Add(new Num { Number = "870", Row = 2 }); 101 Num.Add(new Num { Number = "416", Row = 2 }); 102 Num.Add(new Num { Number = "520", Row = 2 }); 103 Num.Add(new Num { Number = "521", Row = 2 }); 104 Num.Add(new Num { Number = "991", Row = 2 }); 105 Num.Add(new Num { Number = "122", Row = 2 }); 106 Num.Add(new Num { Number = "023", Row = 2 }); 107 Num.Add(new Num { Number = "689", Row = 2 }); 108 Num.Add(new Num { Number = "989", Row = 2 }); 109 Num.Add(new Num { Number = "525", Row = 2 }); 110 Num.Add(new Num { Number = "004", Row = 2 }); 111 Num.Add(new Num { Number = "070", Row = 2 }); 112 Num.Add(new Num { Number = "686", Row = 2 }); 113 Num.Add(new Num { Number = "969", Row = 2, Name = "西西" }); 114 115 Num.Add(new Num { Number = "391", Row = 3, Name = "熊猫", Note = "" }); 116 Num.Add(new Num { Number = "523", Row = 3, Name = "阿刘", Note = "" }); 117 Num.Add(new Num { Number = "729", Row = 3, Name = "可可", Note = "" }); 118 Num.Add(new Num { Number = "707", Row = 3, Name = "小F ", Note = "" }); 119 120 Console.WriteLine(Num.Select(o=>o.Number).Count() + " " + Num.Select(o => o.Number).Distinct().Count() ); 121 122 Console.WriteLine("-----------------------------------------------"); 123 foreach (var item in Num.OrderBy(p=>p.Number)) 124 { 125 Write(item); 126 } 127 var j = 0; 128 Console.WriteLine(); 129 Console.WriteLine("--------------第三批---------------------------"); 130 131 foreach (var item in Num.Where(o=>o.Row==3).OrderBy(p => p.Number)) 132 { 133 j++; 134 Console.ForegroundColor = ConsoleColor.Red; 135 Console.WriteLine(j.ToString("00") + ". " + item.Number + " " + item.Name.ToString() ); 136 } 137 j = 0; 138 139 Console.ReadKey(true); 140 } 141 public static int i = 0; 142 143 public static void Write(Num num) 144 { 145 i++; 146 switch(num.Row) 147 { 148 case 1: 149 Console.ForegroundColor = ConsoleColor.Green; 150 Console.Write(num.Number); Console.Write(" "); break; 151 case 2: 152 Console.ForegroundColor = ConsoleColor.Yellow; 153 Console.Write(num.Number); Console.Write(" "); break; 154 case 3: 155 Console.ForegroundColor = ConsoleColor.Red; 156 Console.Write(num.Number); Console.Write(" "); break; 157 case 4: 158 Console.ForegroundColor = ConsoleColor.DarkGray; 159 Console.Write(num.Number); Console.Write(" "); break; 160 } 161 if (i % 10 == 0) 162 Console.WriteLine(); 163 } 164 } 165 }