I have a process that can get stuck in an infinite loop and I want to add a 5 second timeout so it doesn't hang forever.
bool FlagSuccess = false;
while (FlagSuccess == false)
{
try
{
//Blah blah blah
FlagSuccess=true;
}
catch
{
}
}