I’m trying to feed a dictionary from a function that returns a KVP.
Main:
guestBook.Add(Functions.GetGuest());
Function:
// Store KVP in a dictionary and return object.
public static KeyValuePair<string, int> GetGuest(string fname, string numOfPar)
{
int strtoint = Convert.ToInt16(numOfPar);
KeyValuePair<string, int> newguest = new KeyValuePair<string, int>(fname, strtoint);
return newguest;
}
Why doesn’t it work?
New contributor
Shishkuman is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
4