CTCClassSchedule.Common.Helpers.ParseCommonHeadingLinkedSections C# (CSharp) Method

ParseCommonHeadingLinkedSections() public static method

public static ParseCommonHeadingLinkedSections ( List linkedSections ) : IList
linkedSections List
return IList
        public static IList<SectionWithSeats> ParseCommonHeadingLinkedSections(List<SectionWithSeats> linkedSections)
        {
            string prevCourseID = String.Empty;
            string prevTitle = String.Empty;
            decimal prevCredits = 0;
            bool prevIsVariableCredits = false;

            IList<SectionWithSeats> common = new List<SectionWithSeats>(linkedSections.Count);

            foreach (SectionWithSeats section in linkedSections)
            {
              if (!(section.CourseID == prevCourseID && ((Section)section).CourseTitle == prevTitle && section.Credits == prevCredits && section.IsVariableCredits == prevIsVariableCredits))
              {
            common.Add(section);
              }

              prevCourseID = section.CourseID;
              prevTitle = ((Section)section).CourseTitle;
              prevCredits = section.Credits;
              prevIsVariableCredits = section.IsVariableCredits;
            }

            return common;
        }