public static T Read <T>(string methodName, string hexBuffer) { Span <byte> buffer = hexBuffer.HexToBytes(); CborReader reader = new CborReader(buffer); MethodInfo method = typeof(CborReader).GetMethod(methodName, new Type[0] { }); return(CreateMethodFunctor <CborReaderFunctor <T> >(method)(reader)); }
public static string Write <T>(string methodName, T value) { using (ByteBufferWriter bufferWriter = new ByteBufferWriter()) { CborWriter writer = new CborWriter(bufferWriter); MethodInfo method = typeof(CborWriter).GetMethod(methodName, new[] { typeof(T) }); CreateMethodFunctor <CborWriterFunctor <T> >(method)(writer, value); return(BitConverter.ToString(bufferWriter.WrittenSpan.ToArray()).Replace("-", "")); } }