Iām probably doing something stupid, but here it is.
I am trying to get FieldInfo from a public event through reflection.
Check out this feature:
public void PlotAllFields(Type type) { BindingFlags all = BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public; FieldInfo[] fields = type.GetFields(all); Console.WriteLine(type + "-------------------------"); foreach (var fieldInfo in fields) { Console.WriteLine(fieldInfo.Name); } } public class Bar : Foo {} public class Foo { public string Test; public event EventHandler Event; public event RoutedEventHandler RoutedEvent; }
Call PlotAllFields (typeof (Foo)); returns:
Call PlotAllFields (typeof (Bar)); returns:
I understand that delegates behind events are private fields, so I cannot access them in a subclass. So far so good.
Then I tried: PlotAllFields (typeof (FrameworkElement)); // from WPF
- _themeStyleCache
- _styleCache
- _templatedParent
- _templateChild
- _flags
- _flags2
- _parent
- _inheritableProperties
- MeasureRequest
- Arrangerequest
- sizeChangedInfo
- _parentIndex
- _parent
- _proxy
- _contextStorage
Well ... Where are the 14 events of the FrameworkElement class ???
source share