jefffhaynes / BinarySerializer

A declarative serialization framework for controlling formatting of data at the byte and bit level using field bindings, converters, and code.
MIT License
290 stars 62 forks source link

feat: SerializeAs Support IValueConverter #200

Open zh3305 opened 1 year ago

zh3305 commented 1 year ago

using

   [FieldOrder(0)]
    [SerializeAs(SerializedType.TerminatedString, StringTerminator = (char)0x20, ConverterType = typeof(HexStringToIntConvert))]
    public int DataAmount { get; set; }

Refs: #199

zh3305 commented 1 year ago

This is a simple implementation. But I think there should be a better way to implement it,