public static void AddChild(this List <NamedChild> list, string key, FileComponent child) { if (child != null) { list.Add(new NamedChild(key, child)); } }
//public List<NamedChild> GenerateChildren() //{ // var type = this.GetType(); // var props = from property in type.GetProperties() // where Attribute.IsDefined(property, typeof(AutoStructureAttribute)) // orderby ((AutoStructureAttribute)property // .GetCustomAttributes(typeof(AutoStructureAttribute), false) // .Single()).Order // select property; // //TODO Cache props // var namedChildGetters = new List<NamedChildGetter>(); // var result = new List<NamedChild>(); // foreach(var prop in Props) // { // if(prop.Value() is FileComponent value) // result.Add(new NamedChild(prop.Name, value); // } // return result; //} protected void AddChildDeprecated(string key, FileComponent child) { if (child != null) { children.Add(new NamedChild(key, child)); } }
protected void AddChildNew(FileComponent child) { if (child != null) { child.Parent = this; } MarkAsChanged(); }
internal NamedChild(string name, FileComponent child) { this.Name = name; this.Child = child; }