I try to get the value from an list by their key. I send the list from one form to another. This is windows form application See my code:
/* First form! */
var list1 = new List<KeyValuePair<string, int>>();
list1.Add(new KeyValuePair<string, int>("Cat", 1));
form2 f3 = new form2(connection , list1);
/* Form2 */
private IList<KeyValuePair<string, int>> _theList;
public editAccount(string connection, List<KeyValuePair<string, int>> arr)
{
InitializeComponent();
_theList = arr;
label1.Text = _theList["Cat"];
}
I think it is obviously what I try to do, so any help is great!
SOLVED : Thanks tons to stackoverflow user Sriram Sakthivel
! Solution:
/* First form*/
Dictionary<string, string> openWith = new Dictionary<string, string>();
openWith.Add("cat", "test");
editAccount f3 = new editAccount(connection, openWith);
/* Form 2 */
private Dictionary<string, string> _theList;
public editAccount(string connection, Dictionary<string, string> arr)
{
InitializeComponent();
_theList = arr;
label1.Text = _theList["cat"];
}