Skip to content

Commit

Permalink
PR Comments
Browse files Browse the repository at this point in the history
Signed-off-by: Joe Feser <joseph.feser@gmail.com>
  • Loading branch information
joefeser committed Jul 30, 2024
1 parent d42bfd3 commit bcbd1a2
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/OpenSearch.Net/Transport/PostData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public interface IPostData<out T>
public enum PostType
{
ByteArray,
#if NETSTANDARD2_1
#if NETSTANDARD2_1 || NET6_0_OR_GREATER
ReadOnlyMemory,
#endif
LiteralString,
Expand Down Expand Up @@ -86,7 +86,7 @@ public abstract class PostData
public static PostData Bytes(byte[] bytes) => new PostData<object>(bytes);

#if NETSTANDARD2_1 || NET6_0_OR_GREATER
public static PostData ReadOnlyMemory(ReadOnlyMemory<byte> bytes) => new PostData<object>(bytes.ToArray());
public static PostData ReadOnlyMemory(ReadOnlyMemory<byte> bytes) => new PostData<object>(bytes);
#endif

public static PostData String(string serializedString) => new PostData<object>(serializedString);
Expand Down Expand Up @@ -135,7 +135,7 @@ public class PostData<T> : PostData, IPostData<T>
private readonly IEnumerable<object> _enumerableOfObject;
private readonly IEnumerable<string> _enumerableOfStrings;
private readonly string _literalString;
#if NETSTANDARD2_1
#if NETSTANDARD2_1 || NET6_0_OR_GREATER
private readonly ReadOnlyMemory<byte> _memoryOfBytes;
#endif

Expand All @@ -145,7 +145,7 @@ protected internal PostData(byte[] item)
Type = PostType.ByteArray;
}

#if NETSTANDARD2_1
#if NETSTANDARD2_1 || NET6_0_OR_GREATER
protected internal PostData(ReadOnlyMemory<byte> item)
{
_memoryOfBytes = item;
Expand Down Expand Up @@ -188,7 +188,7 @@ public override void Write(Stream writableStream, IConnectionConfigurationValues
buffer = settings.MemoryStreamFactory.Create(WrittenBytes);
break;

#if NETSTANDARD2_1
#if NETSTANDARD2_1 || NET6_0_OR_GREATER
case PostType.ReadOnlyMemory:
if (_memoryOfBytes.IsEmpty) return;

Expand Down Expand Up @@ -281,7 +281,7 @@ public override async Task WriteAsync(Stream writableStream, IConnectionConfigur
buffer = settings.MemoryStreamFactory.Create(WrittenBytes);
break;

#if NETSTANDARD2_1
#if NETSTANDARD2_1 || NET6_0_OR_GREATER
case PostType.ReadOnlyMemory:
if (_memoryOfBytes.IsEmpty) return;

Expand Down

0 comments on commit bcbd1a2

Please sign in to comment.