static void Main(string[] args) { int[] A = { 1, 5, 6, 7, 12, 15, 55, 60 }; int[] B = { 2, 4, 5, 6, 8, 9, 44, 44, 55, 56, 87 }; IList<int> C = new List<int>(); int AL = 0; int BL = 0; for (int i = 0; i < A.Length + B.Length - 1; i++) { if (AL >= A.Length) { //如果A全部添加完毕 那么将剩下的B全部添加到C if (BL < B.Length) { AddToList(C, B[BL]); BL++; } else { break; } } else if (BL >= B.Length) { //如果B全部添加完毕 那么将剩下的A全部添加到C if (AL < A.Length) { AddToList(C, A[AL]); AL++; } else { break; } } else { if (A[AL] > B[BL]) { AddToList(C, B[BL]); BL++; } else if (A[AL] < B[BL]) { AddToList(C, A[AL]); AL++; } else { AddToList(C, B[BL]); AL++; BL++; } } } } public static void AddToList(IList<int> C,int item) { if (C.LastOrDefault() < item) { C.Add(item); }; }