public static T To <T>(this RedisString value) { switch (value) { case RedisByteString byteValue: return(byteValue.To <T>()); case RedisCharString charValue: return(charValue.To <T>()); default: throw new NotImplementedException(); } }
private static void WriteString(PipeWriter writer, RedisString value) { var buffer = writer.GetMemory(value.ByteLength); if (value is RedisByteString byteValue) { byteValue.Value.CopyTo(buffer); } else { var charValue = (RedisCharString)value; Encoding.GetBytes(charValue.Value, buffer.Span); } writer.Advance(value.ByteLength); }