public Dictionary<string,string> PopulateSelectedNetwork()
{
Dictionary<string,string> net = new Dictionary<string,string>();
switch (_userNetwork)
{
case "Friendster":
net.Add("key","value");
net.Add("key2", "value2");
break;
.......
Then when I try to get the values from the object I just populated (in a different method):
Dictionary<string, string> net = PopulateSelectedNetwork(); >>System.Web.HttpContext.Current.Response.Write(net["key"] +" - " + net["key2"]);
I get a System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary, at the line marked with a >>. What am I missing here?

New Topic/Question
Reply


MultiQuote





|