What you do not like about this code ? ( I have found 3 things – how many can you find?)
public static MyNewDocument OpenDocument(string FileDocPath,out int codeError)
{
if (string.IsNullOrEmpty(FileDocPath) || !File.Exists(FileDocPath))
{
codeError = 1;
return null;
}
MyNewDocument doc = null;
try
{
doc = new MyNewDocument(FileDocPath);
if (doc == null)
throw new Exception();
codeError = 0;
return doc;
}
catch
{
codeError = 2;
return null;
}
}
Leave a Reply