提交 b6817ba2 编写于 作者: C CyrusNajmabadi

Remove unnecessary tuple creation.

上级 2177b88f
......@@ -65,11 +65,8 @@ public int GetOrAddTypeId(Type type)
public Type GetTypeFromId(int typeId)
=> _types[typeId];
public (Type, Func<ObjectReader, object>) GetTypeAndReaderFromId(int typeId)
=> (_types[typeId], _typeReaders[typeId]);
public Func<ObjectReader, object> GetTypeReader(int index)
=> _typeReaders[index];
public Func<ObjectReader, object> GetTypeReaderFromId(int typeId)
=> _typeReaders[typeId];
public bool RegisterTypeReader(Type type, Func<ObjectReader, object> typeReader)
{
......
......@@ -577,17 +577,17 @@ public Type ReadType()
private Type ReadTypeAfterTag()
=> _binderState.GetTypeFromId(this.ReadInt32());
private (Type, Func<ObjectReader, object>) ReadTypeAndReader()
private Func<ObjectReader, object> ReadTypeReader()
{
_reader.ReadByte();
return _binderState.GetTypeAndReaderFromId(this.ReadInt32());
return _binderState.GetTypeReaderFromId(this.ReadInt32());
}
private object ReadObject()
{
int id = _objectReferenceMap.GetNextReferenceId();
var id = _objectReferenceMap.GetNextReferenceId();
var (type, typeReader) = this.ReadTypeAndReader();
var typeReader = this.ReadTypeReader();
// recursive: read and construct instance immediately from member elements encoding next in the stream
var instance = typeReader(this);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册