• + 1 comment

    Maybe another output option would be interesting to you.
    ...
    string query;
    while ((query = Console.ReadLine()) != null) // Read to the end. It is also suitable if the number of names being checked is unknown.
    {
    if (phoneList.TryGetValue(query, out string phone))
    Console.WriteLine($"{query}={phone}");
    else
    Console.WriteLine("Not found");
    }