migueldeicaza/MonoTouch.Dialog — pull request #86 by poke (2011-12-28 14:19:24+00:00)
Title: Add `SkipNonPublicAttribute` to skip all non-public fields/properties.

Hey, I noticed that MT.Dialog automatically uses all properties and fields of a class when building the `RootElement` via 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 the `SkipNonPublic` attribute, that does exactly that. When populating the `RootElement`, it simply checks if that attribute is present for the class and if that’s the case then `BindingFlags.NonPublic` won’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