private static void DiscoverProperties(Type t, ValueHandler valueHandler, Dictionary<string, ResultBox> result, string basePath) { IEnumerable<PropertyInfo> properties = GetHierarchyPublicProperties(t); foreach (PropertyInfo pi in properties) { Type propertyType = pi.PropertyType; ResultBox rbox; bool isCollection = false; if(ResultBox.TryGetCollection(propertyType, out propertyType)) { if(pi.SetMethod != null) { throw new NotSupportedException($"Collection properties cannot have a setter. Detected at '{OptionPath.Combine(basePath, pi.Name)}'"); } isCollection = true; } if(propertyType.GetTypeInfo().IsInterface) { rbox = new ProxyResultBox(pi.Name, propertyType); } else { rbox = new PropertyResultBox(pi.Name, propertyType); } ValidateSupportedType(rbox, valueHandler); AddAttributes(rbox, pi, valueHandler); //adjust to collection if(isCollection) { rbox = new CollectionResultBox(pi.Name, rbox); } result[pi.Name] = rbox; } }
public DynamicEnumerator(int count, CollectionResultBox parent) { _count = count; _parent = parent; }