public IEnumerable <IBaseElement> GetItems() { if (Items.Count == 0 && Array != null) { foreach (var item in Array) { var complex = new ComplexElement(item); Items.Add(complex); } } return(Items); }
public IBaseElement CreateBaseElement(Type propertyType, string rawName, object value) { //is datetime if (propertyType == typeof(DateTime) || propertyType == typeof(DateTimeOffset)) { var instance = CreateValueElementDateTime(propertyType, rawName, value); return(instance); } //is enum if (propertyType.IsEnum) { var instance = CreateValueElementEnumT(propertyType, rawName, value); return(instance); } //is primitive if (propertyType.IsPrimitive || typeof(IComparable).IsAssignableFrom(propertyType)) { //is generic var instance = CreateValueElementT(propertyType, rawName, value); return(instance); } //is array if (typeof(IEnumerable).IsAssignableFrom(propertyType)) { if (value != null) { var instance = CreateArrayElement(rawName, value); return(instance); } return(null); } //is complex if (value != null) { var complex = new ComplexElement(value); complex.IsIgnored = HasIgnore(rawName); return(complex); } return(null); }