public override bool Equals(object obj) { Convertable o = obj as Convertable; if (o == null) { return(false); } return(this.name.Equals(o.name) && this.value.Equals(o.value)); }
public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value) { if (value.GetType() != typeof(string)) { throw new Exception("value not string"); } string serialised = (string)value; string [] parts = serialised.Split('\t'); if (parts.Length != 2) { throw new Exception("string in incorrect format"); } Convertable convertable = new Convertable(parts [0], parts [1]); return(convertable); }
public override object ConvertFrom (ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value) { if (value.GetType() != typeof (string)) throw new Exception ("value not string"); string serialised = (string) value; string [] parts = serialised.Split ('\t'); if (parts.Length != 2) throw new Exception ("string in incorrect format"); Convertable convertable = new Convertable (parts [0], parts [1]); return convertable; }