Add SkipNonPublicAttribute to skip all non-public fields/properties.
#86
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hey, I noticed that MT.Dialog automatically uses all properties and fields of a class when building the
RootElementvia reflection. As I used it for a class that has internal (private) fields for the public properties, I had all values in the generated dialog twice.So instead of adding
[Skip]to every single private field, I wanted something more global to apply to the class declaration and simply ignore all private fields. As such I created theSkipNonPublicattribute, that does exactly that. When populating theRootElement, it simply checks if that attribute is present for the class and if that’s the case thenBindingFlags.NonPublicwon’t be used for reading the properties/fields of the type.It might be useful to extend this later on, so you can force separate fields/properties to appear regardless of that attribute, but I didn’t need that in this case.
Tell me what you think.
poke