LINQ identity function?

后端 未结 7 2122
日久生厌
日久生厌 2020-12-03 16:22

Just a little niggle about LINQ syntax. I\'m flattening an IEnumerable> with SelectMany(x => x).

My problem i

7条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-03 17:20

    I'd go with a simple class with a single static property and add as many as required down the line

        internal class IdentityFunction
        {
            public static Func Instance
            {
                get { return x => x; }
            }
        }
    
        SelectMany(IdentityFunction.Instance)
    

提交回复
热议问题