public static string SaveAsXML(ListViewLayout layout) { if (layout == null) { return(null); } try { XmlSerializer formatter = new XmlSerializer(typeof(ListViewLayout)); StringWriter writer = new StringWriter(); formatter.Serialize(writer, layout); return(writer.ToString()); } catch (Exception ex) { Trace.WriteLine("SaveAsXML() failed.", ex.Message); } return(null); }
public override bool Equals(object obj) { if (obj == null) { return(false); } ListViewLayout o = obj as ListViewLayout; if (o == null) { return(false); } if (this.SortOrder != o.SortOrder) { return(false); } if (this.SortByColumn != o.SortByColumn) { return(false); } if (this._columns == null && o._columns == null) { return(true); } if (this._columns == null || o._columns == null) { return(false); } if (this._columns.Count != o._columns.Count) { return(false); } for (int i = 0; i < this._columns.Count; i++) { if (String.Compare((string)this._columns[i], (string)o._columns[i]) != 0 || (int)this._columnWidths[i] != (int)o._columnWidths[i]) { return(false); } } return(true); }