in Doc “For bound length fields, the source will be updated with the serialized length. ”
I think it's very easy to understand mistakes,After reading this document, I did not understand the role of FieldLengthAttribute(string path), and then I tested the correct behavior.
FieldLengthAttribute(string path) -> Update to other property
The two APIs have completely different functions. It is recommended to use two names
Suggestion FieldLengthAttribute(string path) -> FieldLengthToAttribute(string path)
It looks like this:
public class TestPerson
{
[FieldOrder(0)]
[FieldLength(1)]
public byte NameLength { get; set; }
[FieldOrder(1)]
[FieldLengthTo(nameof(NameLength))]
public string Name { get; set; }
}
//for old Api
[Obsolete("Use FieldLengthTo")]
public FieldLengthAttribute(string path){....}
in Doc “For bound length fields, the source will be updated with the serialized length. ”
I think it's very easy to understand mistakes,After reading this document, I did not understand the role of
FieldLengthAttribute(string path)
, and then I tested the correct behavior.FieldLengthAttribute(ulong length)
-> Limit lengthFieldLengthAttribute(string path)
-> Update to other propertyThe two APIs have completely different functions. It is recommended to use two names
Suggestion
FieldLengthAttribute(string path)
->FieldLengthToAttribute(string path)
It looks like this: