I have some text in a string which I'm reading in. The object which contains the string provides a method for me to extract the contents of the string and then throws an exception (EndOfStreamException) when the string is empty. At that point I'd like to finish my data extraction and continue with working on it. I'm not very certain how to do this. Here is what I am guessing.
while(/*some condition on the data*/)
try
{
objWithString.ExtractData();
}
catch (Exception e)
{
if(e is EndOfStreamException)
{
break;
}
else
throw e;
}
}
catch(EndOfStreamException e)instead of using the if blockthrow e;.