From ed03faaf07c9d2eb20c8037e65108081e56d7bc6 Mon Sep 17 00:00:00 2001 From: Christopher Cifra Date: Thu, 20 Sep 2018 17:07:03 -0500 Subject: [PATCH] [C#] Fix compile issue when compiling with older versions of C# (#4938) * C# support for directly reading and writting to memory other than byte[]. For example, ByteBuffer can be initialized with a custom allocator which uses shared memory / memory mapped files. Public access to the backing buffer uses Span instead of ArraySegment. Writing to the buffer now supports Span in addition to T[]. To maintain backwards compatibility ENABLE_SPAN_T must be defined. * Remove usage of expression bodied method so that ByteBuffer can be compiled with older version of C#. --- net/FlatBuffers/ByteBuffer.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/net/FlatBuffers/ByteBuffer.cs b/net/FlatBuffers/ByteBuffer.cs index cea7ca3a0..277fc1f82 100644 --- a/net/FlatBuffers/ByteBuffer.cs +++ b/net/FlatBuffers/ByteBuffer.cs @@ -116,7 +116,10 @@ namespace FlatBuffers } #if !ENABLE_SPAN_T - public override byte[] ByteArray => _buffer; + public override byte[] ByteArray + { + get { return _buffer; } + } #endif #if UNSAFE_BYTEBUFFER