public override object Read(CompactBinaryReader reader) { ICompactSerializable custom = (ICompactSerializable)CreateInstance(); custom.Deserialize(reader); return(custom); }
/// <summary> /// Lê um objeto do tipo informado. /// </summary> /// <param name="type">Tipo que será deserializado.</param> /// <returns></returns> public override object ReadObjectAs(Type type) { if (typeof(ICompactSerializable).IsAssignableFrom(type)) { ICompactSerializable graph = Activator.CreateInstance(type) as ICompactSerializable; graph.Deserialize(this); return(graph); } return(TypeSurrogateSelector.GetSurrogateForType(type, _context.CacheContext).Read(this)); }