[BREAKING CHANGE] Field accessors should use property getters in C#

In C#, plain field accessors should not be nonparametric methods
but should be standard property getters.

The accessor methods with parameters were renamed to `GetXxx`
because a method cannot be named identically to a property.

Also, `ByteBuffer.Position`, `FlatBufferBuilder.Offset` and
`FlatBufferBuilder.DataBuffer` are now properties instead
of nonparametric accessor methods, for more idiomatic C# style.

This is a breaking change, all client C# code accessing these
fields needs to be changed (i.e. remove those `()` or add the
`Get` prefix).

Issue: #77
Change-Id: Iaabe9ada076e5ea2c69911cf6170fdda2df3487e
This commit is contained in:
Mormegil
2015-05-06 16:33:50 +02:00
committed by Wouter van Oortmerssen
parent a50711ad13
commit 0ee1b99c5d
10 changed files with 186 additions and 114 deletions

View File

@@ -17,7 +17,6 @@
//#define UNSAFE_BYTEBUFFER // uncomment this line to use faster ByteBuffer
using System;
using System.Linq;
namespace FlatBuffers
{
@@ -42,7 +41,7 @@ namespace FlatBuffers
_pos = 0;
}
public int position() { return _pos; }
public int Position { get { return _pos; } }
// Pre-allocated helper arrays for convertion.
private float[] floathelper = new[] { 0.0f };