Closed gismofx closed 1 year ago
The built-in system NonSerialized attribute allows you to opt out on a per-field or per-property basis. This is detailed in the readme.
The built-in system NonSerialized attribute allows you to opt out on a per-field or per-property basis. This is detailed in the readme.
Thanks! I may suggest adding some keywords to the readme. Would you accept a PR on the readme in the section regarding this?
Also:
[NonSerialized]
works on variables, but not properties..
e.g.
[NonSerialized] //works
private string SettingsFilePath;
[NonSerialized] //CS0592 Error
public int MyProperty { get; set; }
Would you be open to adding a new attribute into your library? Something like "[TomlNonSerialized]"
Oh that's just silly. Why microsoft, why. If you want to PR both the readme and attribute at once, I'll take it, but generally speaking if it's a documentation-only change I'd rather just do it myself.
I can do both at once... Will take me a little while to get to dig into the attributes...Maybe by end of the week. Thanks for the quick replies!
No problem. I'll leave you with a couple hints:
https://github.com/SamboyCoding/Tomlet/blob/master/Tomlet/TomlCompositeSerializer.cs#L35
https://github.com/SamboyCoding/Tomlet/blob/master/Tomlet/TomlCompositeDeserializer.cs#L40
I would like to skip properties from being written to file. Is there an "opt-in" or "opt-out" attribute or a way to skip them when writing to file?
I have a private variable in my class that is getting written out to file and causing some issues e.g.:
private string _SettingsFilePath;
I'm writing like so: