Exemplo n.º 1
0
 public void Serialize <T>(T o, TExchange destination)
 {
     foreach (var member in _members)
     {
         if (member.CanRead)
         {
             member.Serialize(o, destination, _binderImplementation);
         }
     }
 }
Exemplo n.º 2
0
            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);
            }
Exemplo n.º 3
0
 public abstract void Deserialize(TExchange source, object o, TypeBinder <TExchange> binderImplementation);
Exemplo n.º 4
0
 public abstract void Serialize(object o, TExchange destination, TypeBinder <TExchange> binderImplementation);