fluffysheap
4
Q:

trygetvalue c#

string value = "";
if (openWith.TryGetValue("tif", out value))
{
    Console.WriteLine("For key = \"tif\", value = {0}.", value);
}
else
{
    Console.WriteLine("Key = \"tif\" is not found.");
}
0
 //validation
       
  while(!(jukeBoxSongs.TryGetValue(userInput,out user)))
   {
     Console.WriteLine("tell the user what they did wrong");
     Console.WriteLine(" restate the question");
     userInput = Console.ReadLine();//catch the users response with the 
    //same string var you used before 

    }
0

New to Communities?

Join the community