public override void Read(BinaryReader binaryReader) { if (Length == 4) { var startBlock = binaryReader.ReadUInt32(); Value = _memo.Get(startBlock); } else { var value = new string(binaryReader.ReadChars(Length)); if (string.IsNullOrWhiteSpace(value)) { Value = string.Empty; } else { var startBlock = long.Parse(value); Value = _memo.Get(startBlock); } } }
public override void Read(ReadOnlySpan <byte> bytes) { if (Length == 4) { var startBlock = BitConverter.ToUInt32(bytes); Value = _memo.Get(startBlock); } else { var value = Encoding.GetString(bytes); if (string.IsNullOrWhiteSpace(value)) { Value = string.Empty; } else { var startBlock = long.Parse(value); Value = _memo?.Get(startBlock); } } }