Generated C# code does not compile due to missing casts
I believe I've found a couple of bugs in the C# output due to missing casts.

To reproduce compile the below `.ksy` file with C# output.
```ksy
meta:
  id: csharp_bug
  title: demonstration of a kaitai C# bug
  ks-version: 0.9
  endian: le

seq:
  - id: len
    type: variable_sized_num
  - id: some_blob_of_data
    size: len.is_u1 ? len.u1 : len.u8
  - id: some_other_thing
    type: u4
    repeat: expr
    repeat-expr: len.is_u1 ? len.u1 : len.u8

types:
  variable_sized_num:
    seq:
    - id: first_byte
      type: u1
    - id: u8
      type: u8
      if: first_byte == 0x00
    instances:
      u1:
        value: first_byte
        if: first_byte != 0x00
      is_u1:
        value: first_byte != 0x00
      is_u8:
        value: first_byte == 0x00

```

The output includes the following lines, which do not compile:

```csharp
private void _read()
{
    _len = new VariableSizedNum(m_io, this, m_root);
    _someBlobOfData = m_io.ReadBytes((Len.IsU1 ? Len.U1 : Len.U8));
    _someOtherThing = new List<uint>((int) ((Len.IsU1 ? Len.U1 : Len.U8)));
    for (var i = 0; i < (Len.IsU1 ? Len.U1 : Len.U8); i++)
    {
        _someOtherThing.Add(m_io.ReadU4le());
    }
}
```

