public byte EnterChoice()
{
_require(StreamOp.EnterChoice);
_reader.ReadOpenTag(_state.Tag);
var choice = ((ChoiceSchema)_state.Schema);
for(int i = 0; i < choice.Fields.Length; i++)
{
var field = choice.Fields[i];
var expected = Utils.GetExpectedTag(field.Tag, field.Type);
if (_reader.AtTag(expected.ContextTag, expected.ApplicationTag))
{
_stack.Push(new SchemaState(choice, _state.Tag, (byte)i));
_state = new SchemaState(field.Type, field.Tag, -1);
return (byte)i;
}
}
throw new UnexpectedTagException();
}