Friday, 15 February 2013

linq - Best way to convert a huge collection of key value pairs to C# object -



linq - Best way to convert a huge collection of key value pairs to C# object -

i have web service returns object multiple kid objects. parent object kid object has huge array of key value pairs (keyvaluepair[]). @ moment using linq identify keyvaluepair , value.

for smaller collection process seems okay. object receiving service has more 300 key value pairs , searching optimal way map key value pairs object.

is there way or existing library can help me this?

it sounds should build dictionary:

var dictionary = pairs.todictionary(pair => pair.key, pair => pair.value);

then can entry key efficiently. note requires keys distinct. if there can multiple values key, utilize tolookup instead.

c# linq collections mapping

No comments:

Post a Comment