public static FieldAndObjectInfo GetStaticFieldInfo(string property)
{
var props = property.Split('.');
if (props.Length > 1)
{
string className = props.First();
var types = Assembly.GetExecutingAssembly().GetTypes();
Type classType = null;
foreach (var type in types)
{
if (type.Name == className)
{
classType = type;
break;
}
}
if (classType != null)
{
var field = classType.GetMember(props[1])[0];
if (props.Length > 2)
{
string prop = "";
for (int i = 2; i < props.Length; i++)
{
prop += props[i] + ((i < props.Length - 1) ? "." : "");
}
return GetFieldInfo(prop, field.GetValue(null));
}
else
{
var info = new FieldAndObjectInfo();
//info.Objects.Add(field.GetValue(null));
info.Fields.Add(field);
return info;
}
}
}
return null;
}
public static float Average(this float[] floats)