I have to convert System.Collections.Generic.IDictionary<string, decimal>
to System.Collections.Generic.Dictionary<string, decimal>
, and i can't. I tried the ToDictionary method and can't specify right arguments.
I've tried the following:
// my dictionary is PlannedSurfaces (of type IDictionary<string, decimal>)
blabla.ToDictionary<string, decimal>(localConstruction.PlannedSurfaces)
var newDict = new Dictionary<string, decimal>(oldDictionary)
或者在linq
var castedDico = dictionary.ToDictionary(kvp => kvp.Key, kvp => kvp.Value);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.