mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-17 05:50:09 +00:00
3.0
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
@@ -26,7 +25,7 @@ namespace XCharts.Runtime
|
||||
public static int InvokeListCount(object obj, FieldInfo field)
|
||||
{
|
||||
var list = field.GetValue(obj);
|
||||
return (int)list.GetType().GetProperty("Count").GetValue(list, null);
|
||||
return (int) list.GetType().GetProperty("Count").GetValue(list, null);
|
||||
}
|
||||
|
||||
public static void InvokeListAdd(object obj, FieldInfo field, object item)
|
||||
@@ -45,10 +44,9 @@ namespace XCharts.Runtime
|
||||
{
|
||||
var list = field.GetValue(obj);
|
||||
var item = list.GetType().GetProperty("Item").GetValue(list, new object[] { i });
|
||||
return (T)item;
|
||||
return (T) item;
|
||||
}
|
||||
|
||||
|
||||
public static void InvokeListAddTo<T>(object obj, FieldInfo field, Action<T> callback)
|
||||
{
|
||||
var list = field.GetValue(obj);
|
||||
@@ -57,7 +55,7 @@ namespace XCharts.Runtime
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
var item = listType.GetProperty("Item").GetValue(list, new object[] { i });
|
||||
callback((T)item);
|
||||
callback((T) item);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,9 +86,9 @@ namespace XCharts.Runtime
|
||||
{
|
||||
var properties = type.GetProperties();
|
||||
var customList = typeof(List<>).MakeGenericType((properties[properties.Length - 1]).PropertyType);
|
||||
returnObj = (IList)Activator.CreateInstance(customList);
|
||||
var list = (IList)returnObj;
|
||||
foreach (var item in ((IList)obj))
|
||||
returnObj = (IList) Activator.CreateInstance(customList);
|
||||
var list = (IList) returnObj;
|
||||
foreach (var item in ((IList) obj))
|
||||
{
|
||||
if (item == null)
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user