Exemplo n.º 1
0
 public Expression Deserialize(FormatContext context)
 => ReadMethod != null
             ? Expression.Call(context.Buffer, ReadMethod)
             : throw new InvalidOperationException($"No deserializator method was found for type {Type.FullName}");
Exemplo n.º 2
0
 Expression ITypeFormat.Deserialize(FormatContext context)
 => Expression.Call(Expression.Constant(this), nameof(Deserialize), null, context.Buffer);
Exemplo n.º 3
0
 /// <summary>
 /// Shortcut for <c>context.Read(typeof(T))</c>
 /// </summary>
 public static Expression Read <T>(this FormatContext context)
 => context.Read(typeof(T));
Exemplo n.º 4
0
 public abstract Expression Deserialize(FormatContext context);
Exemplo n.º 5
0
 /// <summary>
 /// Shortcut for <c>context.GetFormat(type).Deserialize(context.WithType(type))</c>
 /// </summary>
 public static Expression Read(this FormatContext context, Type type)
 => context.Formats.Get(type).Deserialize(context.WithType(type));