Share via


How to cast Dictionary to Dictionary

Question

Wednesday, August 26, 2009 8:31 PM

Hi all,

What is the most effective way to cast Dictionary<long, myClass> to Dictionary<IComparable, object> ?

Thanks,

Michael.

Thanks, Michael

All replies (2)

Wednesday, August 26, 2009 8:38 PM âś…Answered

Dictionary<long, Program> dic1 = new Dictionary<long, Program>();
var dic2 = dic1.ToDictionary(kvp => kvp.Key as IComparable, kvp => kvp.Value as object);http://blog.voidnish.com


Thursday, August 27, 2009 6:33 AM

Thanks!Thanks, Michael