NoviceToDotNet
NoviceToDotNet

Reputation: 10815

Using dictionary in .NET

can i add one dictionary object to another dictionary. I mean i am having a check box list whose checked item are being added to a dictionary object by using foreach loop. in the same page i am having some more variable which are added to anther dictionary object now i have two dictionary object which i need to pass to a method but i want to know can i add check box dictionary object to another dictionary object and can be passed to a method and if so then on other end how can i open it back to retrieve the all items.

or other good solution please suggest

Upvotes: 1

Views: 247

Answers (2)

Łukasz W.
Łukasz W.

Reputation: 9755

If you really need to pass them both together just pass a list of them like:

List<Dictionary<int, string>>

Upvotes: 1

DavidGouge
DavidGouge

Reputation: 4623

If it is unrelated data, then use two different Dictionaries and pass them separately. Is there a good reason why you would want to only pass one Dictionary? I think KISS applies here.

Upvotes: 1

Related Questions