public RPC DeserializeRPC(ref DataStreamReader reader) { int index = reader.ReadInt(); if (index < 0 || index > _argumentTypes.Length) { throw new NetException($"Cannot deserialize rpc with index {index}"); } Type[] argumentTypes = _argumentTypes[index]; object[] arguments = reader.ReadObjects(argumentTypes); return(info => _rpcDelegates[index].Invoke(info, arguments)); }