public void Serialize <T>(T o, TExchange destination) { foreach (var member in _members) { if (member.CanRead) { member.Serialize(o, destination, _binderImplementation); } } }
public T Deserialize <T>(TExchange source) { if (_isPrimitive) { if (!_binderImplementation.TryGet(null, source, out T result)) { throw new InvalidOperationException($"Unable to deserialize into a primitive type {typeof(T)}"); } return(result); } T o = Activator.CreateInstance <T>(); foreach (var member in _members) { if (member.CanWrite) { member.Deserialize(source, o, _binderImplementation); } } return(o); }
public abstract void Deserialize(TExchange source, object o, TypeBinder <TExchange> binderImplementation);
public abstract void Serialize(object o, TExchange destination, TypeBinder <TExchange> binderImplementation);