summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorWouter van Oortmerssen <wvo@google.com>2015-12-07 17:35:57 -0800
committerWouter van Oortmerssen <wvo@google.com>2015-12-07 17:35:57 -0800
commit96cd275603573ebdea3b6c61d459ea438f3b1525 (patch)
tree134ad026e8b2ed07fa66adeac3db1610e932e550 /net
parent42b48bd55faf0e4a2a957f03e1bd3817fd6b25f0 (diff)
parente083e466b85c1ae512193cee74e0dbd60be5ab87 (diff)
downloadflatbuffers-96cd275603573ebdea3b6c61d459ea438f3b1525.tar.gz
flatbuffers-96cd275603573ebdea3b6c61d459ea438f3b1525.tar.bz2
flatbuffers-96cd275603573ebdea3b6c61d459ea438f3b1525.zip
Merge pull request #288 from mfcollins3/csharp-byte-buffer
Add Get Bytes Method Generator for C#
Diffstat (limited to 'net')
-rw-r--r--net/FlatBuffers/Table.cs15
1 files changed, 15 insertions, 0 deletions
diff --git a/net/FlatBuffers/Table.cs b/net/FlatBuffers/Table.cs
index 09b00285..bd5e3641 100644
--- a/net/FlatBuffers/Table.cs
+++ b/net/FlatBuffers/Table.cs
@@ -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&lt;byte&gt;. 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
{