reproduction of mgravell/protobuf-net#24