473,396 Members | 1,938 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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

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

--
Joanna Carter
Consultant Software Engineer
Nov 17 '05 #1
4 16960
Joanna Carter (TeamB) <jo*****@nospamforme.com> wrote:
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.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 17 '05 #2
"Jon Skeet [C# MVP]" <sk***@pobox.com> a écrit dans le message de news:
MP************************@msnews.microsoft.com...
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

--
Joanna Carter
Consultant Software Engineer
Nov 17 '05 #3
Joanna,

Confess; You where looking for a method called .Assign

=)

- Michael S
Nov 17 '05 #4
"Michael S" <a@b.c> a écrit dans le message de news:
eA**************@TK2MSFTNGP10.phx.gbl...
Confess; You where looking for a method called .Assign


Now how did you guess that ? :-))

Joanna

--
Joanna Carter
Consultant Software Engineer
Nov 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Wilson | last post by:
Hi, How do get the Dictioanry object from FiedlInfo ? my code : fieldInfo = this.GetType().GetField("dictioanry1"); ??Dictionary<string, string> dicTemp1 = (Dictionary<string,...
6
by: buzzweetman | last post by:
Many times I have a Dictionary<string, SomeTypeand need to get the list of keys out of it as a List<string>, to pass to a another method that expects a List<string>. I often do the following: ...
6
by: daohuy.hua | last post by:
The context is that I have a C# class named MainModel which has a private Dictionary<string, FileStreammember named dict. I also have a property Dict to access to this member: public...
13
by: liujiaping | last post by:
Hi, all. I have a dictionary-like file which has the following format: first 4 column 7 is 9 a 23 word 134 .... Every line has two columns....
2
by: Assimalyst | last post by:
Hi I have a Dictionary<string, List<string>>, which i have successfully filled. My problem is I need to create a filter expression using all possible permutations of its contents. i.e. the...
6
by: Paul.N.Phillips | last post by:
I am using a static dictionary to objects (like cache) but woundered if it is better to use cache. Which one would should I use?
0
by: Andy B | last post by:
Is there a way to databind a checkBoxList to a Dictionary<string, string> object? If so, how do you do it?
2
by: Andy B | last post by:
I don't know if this is even working or not but here is the problem. I have a gridview that I databound to a dictionary<string, stringcollection: Contract StockContract = new Contract();...
9
by: whosaidwhat | last post by:
Hello, I am creating a program that has a byte used as the key for a Dictionary class. The problem is best described with an example: (C# example of problem) private Dictionary<byte,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.