Working with dictionary
-
Hi, I have to return corresponding country currency from a function. I have a disctionary like Dictionary> that will contain like: Dictionary> str = new Dictionary>(); List currency= GetCurrency();//Will return all currency stored in database. str.Add("Currency",currency); Now currency list contains only currency. I would like to add corresponding country also. I know that I can create datatable,change the dictionary value to DataTable/DataSet type and return.. Datatable is heavy object...So is there any other approach to achieve this? Many thanks.
-
Hi, I have to return corresponding country currency from a function. I have a disctionary like Dictionary> that will contain like: Dictionary> str = new Dictionary>(); List currency= GetCurrency();//Will return all currency stored in database. str.Add("Currency",currency); Now currency list contains only currency. I would like to add corresponding country also. I know that I can create datatable,change the dictionary value to DataTable/DataSet type and return.. Datatable is heavy object...So is there any other approach to achieve this? Many thanks.
Hi, 1. you should use PRE tags to show code snippets, and HTML-escape all < and > and & signs to make them show properly. 2. this would be pretty close to what you want:
Dictionary<string,string>currencies=new Dictionary<string,string>();
string country="Belgium";
string currency="Euro";
currencies[country]=currency;:) EDIT recased some /EDIT
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
modified on Tuesday, February 22, 2011 12:48 PM
-
Hi, 1. you should use PRE tags to show code snippets, and HTML-escape all < and > and & signs to make them show properly. 2. this would be pretty close to what you want:
Dictionary<string,string>currencies=new Dictionary<string,string>();
string country="Belgium";
string currency="Euro";
currencies[country]=currency;:) EDIT recased some /EDIT
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
modified on Tuesday, February 22, 2011 12:48 PM
your really going to post code that mixes case of local variables to help answer a question?
Need custom software developed? I do custom programming based primarily on MS tools with an emphasis on C# development and consulting. I also do Android Programming as I find it a refreshing break from the MS. "And they, since they Were not the one dead, turned to their affairs" -- Robert Frost
-
your really going to post code that mixes case of local variables to help answer a question?
Need custom software developed? I do custom programming based primarily on MS tools with an emphasis on C# development and consulting. I also do Android Programming as I find it a refreshing break from the MS. "And they, since they Were not the one dead, turned to their affairs" -- Robert Frost
yes it seems I have been on the wrong casing track. All fixed. :thumbsup:
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.