public static string ArrSe(Type t, IEnumerable items, SeCtx ctx) { IEnumerable <object> f() { foreach (var item in items) { yield return(item); } } return(string.Join(" ", (from item in f() select ItemSe(t, item, ctx)))); }
public static string ItemSe(Type t, object o, SeCtx ctx) { if (o == null) { return("null"); } if (typeof(DateTime).IsAssignableFrom(t)) { return(SeDate((DateTime)o)); } if (t.IsGenericType && typeof(Nullable <>).IsAssignableFrom(t.GetGenericTypeDefinition())) { return(SeNullable(t, o, ctx)); } if (t.GetInterfaces().FirstOrDefault(i => i.IsGenericType && typeof(IDictionary <,>).IsAssignableFrom(i.GetGenericTypeDefinition())) != null) { return(SeMap(t, o, ctx)); } if (t.IsPrimitive) { return(SePrimitive(t, o)); } if (typeof(string).IsAssignableFrom(t)) { return(SeStr(o)); } if (typeof(IEnumerable).IsAssignableFrom(t)) { return(SeArr(o, ctx)); } if (t.IsEnum) { return(SeEnum(t, o)); } if (t.GetCustomAttribute <CbonUnionAttribute>() != null) { return(SeUnion(t, o, ctx)); } return(SeObj(t, o, ctx)); }