1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5 using System.Threading.Tasks;
6
7 namespace LinqDemo
8 {
9 class Program
10 {
11 static void Main(string[] args)
12 {
13 List<TypeEnum> lstTypeEnum = new List<TypeEnum>() { TypeEnum.A,TypeEnum.B,TypeEnum.C };
14
15 var lstType = lstTypeEnum.Aggregate(new List<int>(),
16 (total,next) =>
17 {
18 total.Add(((int)next));
19 return total;
20 }
21 );
22
23 Console.WriteLine(string.Join(",", lstType.ToArray()));//输出1,2,3
24 Console.ReadKey();
25 }
26 }
27 public enum TypeEnum
28 {
29 A = 1,B = 2,C=3
30 }
31 }