Cast a hashtable.Keys into List or other IEnumerable

后端 未结 6 687
伪装坚强ぢ
伪装坚强ぢ 2020-12-31 16:40

I know, I have other options, e.g. I could maintain a separate list of keys. Please don\'t suggest other options. I simply want to know if I can pull this off. Please don\'t

6条回答
  •  粉色の甜心
    2020-12-31 16:57

    Either use Dictionary instead of non-generic version. Or use CastTo extension method. See http://msdn.microsoft.com/en-us/library/system.collections.icollection.aspx for details on non-generic collection returned by Hastable.Key as well link to casting method you can use.

提交回复
热议问题