代码之家  ›  专栏  ›  技术社区  ›  Midhat

将匿名类型组传递给函数

  •  0
  • Midhat  · 技术社区  · 14 年前

    我需要将匿名类型索引上的I组传递给函数。

     List<DataClass> sampleList = new List<DataClass>();
     var groups = sampleList.GroupBy(item => new { item.A, item.B, item.C }); 
    

    static void ProcessGroup<T>(IGrouping<T, DataClass> group)
            { 
            //consume group
    
            }
    

    现在我需要知道为什么这样做,这是正确的方式来传递这种数据。我只是预感到 可以

    1 回复  |  直到 14 年前
        1
  •  4
  •   Eric Lippert    14 年前

    我要知道为什么这样

    这是传递这种数据的正确方式吗?