Some code in the samples and docs still used old C# API.

Change-Id: I7914c88ad7b31baa7586771423069dc2b90d534f
Tested: on Linux.
This commit is contained in:
Wouter van Oortmerssen
2017-05-22 15:13:20 -07:00
parent aaf5598a03
commit 398ae0cb6b
2 changed files with 22 additions and 26 deletions

View File

@@ -1541,10 +1541,10 @@ To access sub-objects, in the case of our `pos`, which is a `Vec3`:
</div>
<div class="language-csharp">
~~~{.cs}
var pos = monster.Pos
var x = pos.X
var y = pos.Y
var z = pos.Z
var pos = monster.Pos.Value;
var x = pos.X;
var y = pos.Y;
var z = pos.Z;
~~~
</div>
<div class="language-go">
@@ -1618,7 +1618,7 @@ FlatBuffers `vector`.
<div class="language-csharp">
~~~{.cs}
int invLength = monster.InventoryLength;
var thirdItem = monster.GetInventory(2);
var thirdItem = monster.Inventory(2);
~~~
</div>
<div class="language-go">
@@ -1675,8 +1675,8 @@ except your need to handle the result as a FlatBuffer `table`:
<div class="language-csharp">
~~~{.cs}
int weaponsLength = monster.WeaponsLength;
var secondWeaponName = monster.GetWeapons(1).Name;
var secondWeaponDamage = monster.GetWeapons(1).Damage;
var secondWeaponName = monster.Weapons(1).Name;
var secondWeaponDamage = monster.Weapons(1).Damage;
~~~
</div>
<div class="language-go">
@@ -1758,8 +1758,7 @@ We can access the type to dynamically cast the data as needed (since the
var unionType = monster.EquippedType;
if (unionType == Equipment.Weapon) {
var weapon = (Weapon)monster.GetEquipped(new Weapon()); // Requires explicit cast
// to `Weapon`.
var weapon = monster.Equipped<Weapon>().Value;
var weaponName = weapon.Name; // "Axe"
var weaponDamage = weapon.Damage; // 5