Hello,
I have this method and want to get all properties from the FieldInfos? How to get it?
private static void FindFields(ICollection<FieldInfo> fields, Type t)
{
var flags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance | BindingFlags.DeclaredOnly;
foreach (var field in t.GetFields(flags))
{
fields.Add(field);
}
var baseType = t.BaseType;
if (baseType != null)
{
FindFields(fields, baseType);
}
}
var fields = new Collection<FieldInfo>();
FindFields(fields, this.GetType());
Thanks.
Best regards.