Have this dictionay retrieving values from DataTable:
Dictionary开发者_JAVA技巧<string,string> meta= ds.Tables[1].Select("key<>'format'").AsEnumerable().ToDictionary(k=>k.Field<string>(0),v=>v.Field<string>(1));
How would I apply StringComparer.OrdinalIgnoreCase as Mehrdad Afshari suggested ?
You can wrap it in another constructor:
var meta = new Dictionary<string,string>(ds.Tables[1]
.Select("key<>'format'")
.AsEnumerable()
.ToDictionary(k=>k.Field<string>(0),
v=>v.Field<string>(1)),
StringComparer.OrdinalIgnoreCase);
精彩评论