AvroConvert
AvroConvert copied to clipboard
Private fields marked with [DataMember] attribute are ignored during serialization/deserialization
[DataMember] fields are resolved during schema generation.
There is no easy way (without significant performance hit) for serialization and deserialization of private fields. If you feel, that this is your case - please leave a comment down below. Maybe we'll figure out the right solution.
Serialization code snippet
var privateFields = type.GetFields(BindingFlags.Instance | BindingFlags.NonPublic);
var targetField = privateFields.FirstOrDefault(f => f.Name.Contains(name));
value = targetField?.GetValue(recordObj);