public static bool FillIfCustomSerialization(this object rec, object payload) { if (rec.GetType().IsDynamicType()) { return(false); } if (typeof(IChoCustomSerializable).IsAssignableFrom(rec.GetType())) { IChoCustomSerializable obj = rec as IChoCustomSerializable; obj.Deserialize(payload); return(true); } return(false); }
public static bool ToTextIfCustomSerialization(this object rec, out string recText) { recText = null; if (rec.GetType().IsDynamicType()) { return(false); } if (typeof(IChoCustomSerializable).IsAssignableFrom(rec.GetType())) { IChoCustomSerializable obj = rec as IChoCustomSerializable; recText = obj.Serialize().ToNString(); return(true); } return(false); }