mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-30 19:50:00 +00:00
[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<T> instead of ArraySegment<T>. Writing to the buffer now supports Span<T> 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#.
This commit is contained in:
committed by
Wouter van Oortmerssen
parent
02a7807dd8
commit
ed03faaf07
@@ -116,7 +116,10 @@ namespace FlatBuffers
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if !ENABLE_SPAN_T
|
#if !ENABLE_SPAN_T
|
||||||
public override byte[] ByteArray => _buffer;
|
public override byte[] ByteArray
|
||||||
|
{
|
||||||
|
get { return _buffer; }
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if UNSAFE_BYTEBUFFER
|
#if UNSAFE_BYTEBUFFER
|
||||||
|
|||||||
Reference in New Issue
Block a user