diff --git a/src/csharp/Grpc.Core/Internal/DefaultDeserializationContext.cs b/src/csharp/Grpc.Core/Internal/DefaultDeserializationContext.cs index bac7bbe4c59..946c37de190 100644 --- a/src/csharp/Grpc.Core/Internal/DefaultDeserializationContext.cs +++ b/src/csharp/Grpc.Core/Internal/DefaultDeserializationContext.cs @@ -82,14 +82,11 @@ namespace Grpc.Core.Internal return instance; } -#if GRPC_CSHARP_SUPPORT_SYSTEM_MEMORY private void FillContinguousBuffer(IBufferReader reader, byte[] destination) { +#if GRPC_CSHARP_SUPPORT_SYSTEM_MEMORY PayloadAsReadOnlySequence().CopyTo(new Span(destination)); - } #else - private void FillContinguousBuffer(IBufferReader reader, byte[] destination) - { int offset = 0; while (reader.TryGetNextSlice(out Slice slice)) { @@ -98,7 +95,7 @@ namespace Grpc.Core.Internal } // check that we filled the entire destination GrpcPreconditions.CheckState(offset == payloadLength); - } #endif + } } }