Alex Rivera | Logout

C# Reflection - Base class static fields in Derived type

Asked 2009-08-24T23:18:42.547
13

In C#, when I'm reflecting over a derived type, how come I don't see base classes' static fields?

I've tried both type.GetFields(BindingFlags.Static) and type.GetFields().

Edit
Report

1 Answer

5

Set the BindingFlags.FlattenHierarchy enumeration to Static and this will also search static members. More information: http://msdn.microsoft.com/en-us/library/system.reflection.bindingflags.aspx

answered 2009-08-24T23:25:49.257

Your Answer