I have an application that reads in data from a text file. I recently realized that I had to do a data check for the data in a text file to see if I can display / process it correctly.
In principle, at the moment, the entire check is performed if the data is in the correct format, i.e. double is double, int is int, etc. And if it's not me, I chose an exception.
Same:
private static string CheckDouble(string doublevar)
{
double tryParseDoubleResult;
var tryParseDouble = double.TryParse(doublevar, out tryParseDoubleResult);
if (tryParseDouble)
{
return doublevar;
}
throw new Exception("Invalid data found. Cannot open.");
}
That would be great. Except for the following:
- I built this in a Win 7 environment in VS 2008.
- I tested in Win7 / XP
- Win7 - . , , , , . , , . Debug, , Release.
- XP .
, , , , , , , .
Win7?
, , , , , . , ? Try? ( , XP, ...)
, 3 . - "". .
var w = new Window1();
w.Show();
// FormLoad tabitems 1, . , , , , Close(); , - , - .
Close();
edit1:
, , Singleton, , ...
edit2:
, . : , , . , . . , , , Environment.Exit(1); . .
...
, , , XP ( ), Win7 - .