The following assumes a key value that is a single byte, with 4 expected items in the group, all of which have a byte of ...

The following assumes a key value that is a single byte, with 4 expected items in the group, all of which have a byte of data following the key.  The items appear in the input as follows:
  • Key 1 is required, and does appear with value 11.
  • Key 2 repeats, and appears twice with value 22, and results in a value of { 22, 22 }.
  • Key 3 is optional, and does not appear, and results in a value of null.
  • Key 4 repeats, but does not appear, and results in a value of { }.
  • Key 5 is not part of the group, but appears once with value 55. The extra function is called with the key value 5, and returns the format corresponding to that value (BinaryFormat.Byte). The value 55 is read and discarded.