public static void SaveToFile(object o, string filter = null) { try { SaveFileDialog f = new SaveFileDialog(); if (filter == null) { f.Filter = "Text Files(*.txt)|*.txt|All Files(*.*)|*.*"; } else { f.Filter = filter; } if (f.ShowDialog().Value) { CommonProc.SaveObjToFile(o, f.FileName); } } catch (Exception ex) { throw ex; } }