Some code
What you do not like about this code ? ( I have found 3 things – how many can you find?)
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | 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 ; } } |