Reflecting over properties in .NET
Friday, October 6th, 2006I always forget the binding flags needed to reflect over properties in .NET. So this is mainly an aide-mémoire for myself.
PLAIN TEXT
C#:
PropertyInfo[] props = typeof(MyType).GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
I ALWAYS forget that you need to include the BindingFlags.NonPublic flag!
