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