You can use GetSetMethod () to determine if the setter is publicly available or not.
For instance:
typeof(X).GetProperties(BindingFlags.SetProperty | BindingFlags.Public | BindingFlags.Instance) .Where(prop => prop.GetSetMethod() != null) .Select (x => x.Name).Dump();
GetSetMethod() returns a public method installer; if it does not have it, it returns null .
Since the property may have different visibility than the setting tool, it must be filtered by the visibility of the setter method.
source share