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))); } }
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))); } }