예제 #1
0
 private async ValueTask <T> DeserializeAsync <T>(
     ObjectSerializer serializer,
     bool async)
 {
     Argument.AssertNotNull(serializer, nameof(serializer));
     if (async)
     {
         return((T)await serializer.DeserializeAsync(
                    ToStream(),
                    typeof(T))
                .ConfigureAwait(false));
     }
     else
     {
         return((T)serializer.Deserialize(ToStream(), typeof(T)));
     }
 }
예제 #2
0
 private static async ValueTask <T> AsAsync <T>(
     this BinaryData data,
     ObjectSerializer serializer,
     bool async)
 {
     Argument.AssertNotNull(serializer, nameof(serializer));
     if (async)
     {
         return((T)await serializer.DeserializeAsync(
                    data.AsStream(),
                    typeof(T))
                .ConfigureAwait(false));
     }
     else
     {
         return((T)serializer.Deserialize(data.AsStream(), typeof(T)));
     }
 }