private void InitializeContent <T>(MsBuildElementFactory factory) where T : IMsBuildElement { foreach (XmlElement childElement in _element.ChildNodes.OfType <XmlElement>()) { T target = factory.Create <T>(childElement); if (target != null) { _elements.Add(target); } } }
/// <inheritdoc /> public virtual IList <T> GetChildren <T>() where T : class, IMsBuildElement { IList <T> foundMatchingChildItems = new List <T>(); MsBuildElementFactory factory = new MsBuildElementFactory(); foreach (XmlElement childElement in XmlElement.ChildNodes.OfType <XmlElement>()) { T createdObject = factory.Create <T>(childElement); if (createdObject != null) { foundMatchingChildItems.Add(createdObject); } } return(foundMatchingChildItems); }