Cast from one generic IDictionary to another

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • pierre.k

    Cast from one generic IDictionary to another

    Hello,
    how can I do a cast like
    IDictionary<int , stringas IDictionary<obj ect, string ?

    Thanks in advance for your help,
    pierre.k
  • Stanimir Stoyanov

    #2
    Re: Cast from one generic IDictionary to another

    You can't just cast a generic dictionary with a different key data type. You
    can however create the second dictionary, copy the original keys to an int[]
    using the Keys.CopyTo method, go through them and populate the new
    dictionary with the old data.

    Stanimir Stoyanov | www.stoyanoff.info

    "pierre.k" <petr.krebs@gma il.comwrote in message
    news:91380878-51a9-42ac-88b5-66d61c6e802a@c6 5g2000hsa.googl egroups.com...
    Hello,
    how can I do a cast like
    IDictionary<int , stringas IDictionary<obj ect, string ?
    >
    Thanks in advance for your help,
    pierre.k

    Comment

    Working...