Ejemplo n.º 1
0
        /// <summary>
        /// Builds a new collection where element of the specified type
        /// are removed.
        /// </summary>
        /// <param name="elementType">Type of the element.</param>
        /// <returns></returns>
        public ConfigurationCollection Remove(string elementType)
        {
            ConfigurationCollection newCollection = new ConfigurationCollection();

            for (int i = 0; i < Count; i++)
            {
                if (this[i].Type != elementType)
                {
                    newCollection.Add(this[i]);
                }
            }
            return(newCollection);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Finds the IConfiguration element that are from the specified element type.
        /// </summary>
        /// <param name="elementType">Type of the element.</param>
        /// <returns>A list of IConfiguration</returns>
        public ConfigurationCollection Find(string elementType)
        {
            ConfigurationCollection liste = new ConfigurationCollection();

            for (int i = 0; i < Count; i++)
            {
                if (elementType.Equals(this[i].Type))
                {
                    liste.Add(this[i]);
                }
            }

            return(liste);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Recursive find of the IConfiguration element that are from the specified element type.
        /// </summary>
        /// <param name="elementType">Type of the element.</param>
        /// <returns>A list of IConfiguration</returns>
        public ConfigurationCollection RecursiveFind(string elementType)
        {
            ConfigurationCollection list = new ConfigurationCollection();

            for (int i = 0; i < Count; i++)
            {
                if (elementType.Equals(this[i].Type))
                {
                    list.Add(this[i]);
                }
                list.AddRange(this[i].Children.RecursiveFind(elementType));
            }

            return(list);
        }