private static Dictionary<string, object> CreateObjectProperty<T>(T t, Operate o, out string typeName)
{
//获取名称
typeName = t.GetType().Name;
Dictionary<string, object> dict = new Dictionary<string, object>();
//获取所有属性
System.Reflection.PropertyInfo[] properties = t.GetType().GetProperties(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public);
foreach (System.Reflection.PropertyInfo item in properties)
{
string name = item.Name;
object value = item.GetValue(t, null);
if (value.GetType().IsGenericType)
{
int count = (int)value.GetType().GetProperty("Count").GetValue(value, null);
for (int i = 0; i < count; i++)
{
object[] index = { i };
object obj = value.GetType().GetProperty("Item").GetValue(value, index);
System.Reflection.PropertyInfo[] objpro = obj.GetType().GetProperties();
foreach (System.Reflection.PropertyInfo info in objpro)
{
string name1 = info.Name;
string value1 = info.GetValue(obj, null) as string;
}
}
}
if (dict != null && dict.ContainsKey(name)) continue;
else
dict.Add(name, value);
}
return dict;
}