开发者

Convert object[] into Lookup with Linq

开发者 https://www.devze.com 2023-02-24 16:59 出处:网络
We have the following object[]. [0][1] = \'ABC\' [2] = 123 [3] = 456 [1][1] = \'DEF\' [2] = 789 [3] = 012 Is it possible to do a Select() and ToLookup() against this so that [i][3] would be my loo

We have the following object[].

[0][1] = 'ABC'
   [2] = 123
   [3] = 456

[1][1] = 'DEF'
   [2] = 789
   [3] = 012

Is it possible to do a Select() and ToLookup() against this so that [i][3] would be my look开发者_Python百科up key and [1] [2] would be the value?


source.ToLookup(k => k[3], k => new object[] {k[1], k[2] });
0

精彩评论

暂无评论...
验证码 换一张
取 消