mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-22 19:18:53 +00:00
Merge pull request #288 from mfcollins3/csharp-byte-buffer
Add Get Bytes Method Generator for C#
This commit is contained in:
@@ -67,6 +67,21 @@ namespace FlatBuffers
|
||||
return offset + bb.GetInt(offset) + sizeof(int); // data starts after the length
|
||||
}
|
||||
|
||||
// Get the data of a vector whoses offset is stored at "offset" in this object as an
|
||||
// ArraySegment<byte>. If the vector is not present in the ByteBuffer,
|
||||
// then a null value will be returned.
|
||||
protected ArraySegment<byte>? __vector_as_arraysegment(int offset) {
|
||||
var o = this.__offset(offset);
|
||||
if (0 == o)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var pos = this.__vector(o);
|
||||
var len = this.__vector_len(o);
|
||||
return new ArraySegment<byte>(this.bb.Data, pos, len);
|
||||
}
|
||||
|
||||
// Initialize any Table-derived type to point to the union at the given offset.
|
||||
protected TTable __union<TTable>(TTable t, int offset) where TTable : Table
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user