Beispiel #1
0
 /// <summary>
 /// Gets the first section with the given name. If no such section exists,
 /// <c>null</c> is returned.
 /// </summary>
 /// <param name="name">The section name to look for.</param>
 /// <returns>The first section with the given name, if it exists; otherwise, <c>null</c>.</returns>
 public Section GetFirstSectionOrNull(SectionName name)
 {
     for (int i = 0; i < Sections.Count; i++)
     {
         var sec = Sections[i];
         if (sec.Name == name)
         {
             return(sec);
         }
     }
     return(null);
 }
Beispiel #2
0
        /// <summary>
        /// Gets a list of all sections with the given section name.
        /// </summary>
        /// <param name="name">The section name to look for.</param>
        /// <returns>A list of sections with the given section name.</returns>
        public IReadOnlyList <Section> GetSections(SectionName name)
        {
            var results = new List <Section>();

            for (int i = 0; i < Sections.Count; i++)
            {
                var sec = Sections[i];
                if (sec.Name == name)
                {
                    results.Add(sec);
                }
            }
            return(results);
        }