Solution using a bool variable,
int counter = 0;
string dt;
bool isFound = false;
StreamReader file = new StreamReader(path);
while ((dt = file.ReadLine()) != null)
{
if (dt.Contains(thisLetter))
{
isFound = true;
thisType = dt;
}
counter++;
}
if(!isFound)
{
Console.WriteLine("string not found");
}
file.Close();