Easy way to copy a Dictionary<string, object> ?

  • Thread starter Joanna Carter \(TeamB\)
  • Start date
J

Joanna Carter \(TeamB\)

I would like to copy the contents of a Dictionary<string, object> to another
Dictionary<string, object>. Do I have to iterate the source use something
like foreach or is there an easier way ?

Joanna
 
J

Jon Skeet [C# MVP]

Joanna Carter (TeamB) said:
I would like to copy the contents of a Dictionary<string, object> to another
Dictionary<string, object>. Do I have to iterate the source use something
like foreach or is there an easier way ?

Have you tried the constructor overload which takes another dictionary
of the same type? I don't have the beta installed yet, but from the
docs it looks like it should work.
 
J

Joanna Carter \(TeamB\)

Have you tried the constructor overload which takes another dictionary
of the same type? I don't have the beta installed yet, but from the
docs it looks like it should work.

Excellent Jon, I'll try that tomorrow. It's amazing just how big a help file
can seem when you are looking for something :))

Joanna
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top