c# - How to get distinct keys when a Dictionary's key is a string array -
i have variable called data defined as:
dictionary<string[], dictionary<string, float>> data
as can see, key string array , value inner dictionary. each key can have items like:
{"xxx", "ccc", "wpr", "qpr"} {"xxx", "abd", "xyz", "qpr"} {"yyy", "ddd", "kgo", "abc"}
how can use linq distinct first items of key? example, in example above, should xxx , yyy result. 2 of these keys have xxx , 1 has yyy first items.
the array of strings in key of dictionary used row identifier. data dictionary contains data exported excel. inherited application cannot redefine variable. key used identify , grouping of totals in excel. why original developer did way.
the string keys have same length.
something like...
var result=data.keys.select(k=>k[0]).distinct();
Comments
Post a Comment