public class mo { public int q1 { get; set; } public int count { get; set; } } class Class1 { static void Main(string[] args) { int[] a = new int[] { 1, 2, 3, 4, 5 }; int[] b1 = new int[] { 1, 2, 3 }; int[] c1 = new int[] { 1, 2, 3, 4, 5 }; mo[] wer = new mo[]//第一种 { new mo{q1=1,count=3}, }; int[][] io=new int[][] { new int[] { 1, 2 } }; int[][] pi = new int[][] { b1, c1 };//第二种 List<int[]> cd = new List<int[]> { a, b1, c1 };//第三种 var re = from f in cd from q in f where q > 2 select new mo { q1 = q, count = f.Count() }; foreach (mo o in re)//输出 { Console.WriteLine(o.q1); Console.WriteLine($"数量是:{o.count}"); } foreach(int[] p in io) { foreach(int op in p) { Console.WriteLine(op); } }
标签:q1,count,Console,C#,mo,嵌套,int,数组,new From: https://www.cnblogs.com/lin-07/p/17556528.html