GetProperty BindingFlags.IgnoreCase wont work without public and Instance in c#
c#, reflection
Solution
The overload which doesn't take `BindingFlags` effectively defaults to `BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance`. That's why it finds it in your first snippet.
If you do specify a `BindingFlags`, you have to specify all the relevant flags - which includes flags to say whether you want to see public members, whether you want to see non-public members, whether you want to see instance members, and whether you want to see static members.
When you just specify `BindingFlags.IgnoreCase`, you haven't said you want to see any of those, so it won't find anything.
Problem
``` Type t = typeof(T); t.GetProperty("Company") ``` If i write the below code it will give null ``` Type t = typeof(T); t.GetProperty("company", BindingFlags.IgnoreCase) ``` In the mean time if i write this works fine.Why is that so ? ``` Type t = typeof(T); t.GetProperty("company", BindingFlags.IgnoreCase|BindingFlags.Public | BindingFlags.Instance) ```