public static void Write(string path, string name, string message, Exception exception) { try { StreamWriter sw = new StreamWriter(path,true, System.Text.Endcoding.Default); Dispose instance = new Dispose(); sw.WriteLine(name +" " + DateTime.Now +" "+message + exception); } catch (Exception ex) { System.Console.WriteLine(ex); } finally { instance.Dispose() } }
public static void Write(string path, string name, string message, params object[] args) { try { StreamWriter sw = new StreamWriter(path,true, System.Text.Endcoding.Default); Dispose instance = new Dispose(); sw.WriteLine(name +" " + DateTime.Now +" "+message + argv); for (int i = 0; i < args.Lenght; i++) { argv += args[i] } } catch (Exception ex) { System.Console.WriteLine(ex); } finally { instance.Dispose() } }