private static void AddArray(object item, PropertyInfo property, KOModel model, bool observable) { var listType = GetListType(property.PropertyType); if (IsSimpleType(listType)) { dynamic list = property.GetValue(item) ?? new List <object>(); model.AddArray(ToJavascriptName(property), list, observable); } else { var list = property.GetValue(item) as IEnumerable <object> ?? new List <object>(); model.AddArray(ToJavascriptName(property), list.Select(x => x.ToKO()), observable); } }
public static KOModel ToKO(this IEnumerable <object> list, string name) { var model = new KOModel(); model.AddArray(name, list.Select(item => ToKO((object)item)).ToList(), true); return(model); }
public static KOModel ToKO(this IEnumerable<object> list, string name) { var model = new KOModel(); model.AddArray(name, list.Select(item => ToKO((object) item)).ToList(), true); return model; }
private static void AddArray(object item, PropertyInfo property, KOModel model, bool observable) { var listType = GetListType(property.PropertyType); if (IsSimpleType(listType)) { dynamic list = property.GetValue(item) ?? new List<object>(); model.AddArray(ToJavascriptName(property), list, observable); } else { var list = property.GetValue(item) as IEnumerable<object> ?? new List<object>(); model.AddArray(ToJavascriptName(property), list.Select(x => x.ToKO()), observable); } }