Link to home
Start Free TrialLog in
Avatar of jmpatton

asked on

Help Needed Looping through collections with .NET


I have two collections (Collection A and Collection B) and I need to loop through collection A while comparing each one to Collection B.  Im looking for scheduling conflicts. If I find a conflict I need to add it to a List Object. I've never done this before so im not sure where to start to describe my problem.  Here is the code I haev so far. Any help would be appreciated.  

I first get a list of SourceScheduledEvents, then a list of possible ConflictingScheduleEvents.  As I loop through the SourceScheduledEvents object, there is an attribute called SourceStartDateTime.  I need to compare this attribute to an attribute in the ConflictingScheduleEvents (conflictingStartDateTime).  If they are within 2 hours of each other I need to add them to the resulting list conflictDetailEventList.

Thanks for takin the time to read this and help
public ConflictDetailEventList CompareScheduledEvents(string sourceStation, string sourcePipeline, string sourceJunction, string conflictJunction, int interval)
            ConflictDetailEventList conflictDetailEventList = new ConflictDetailEventList();

            ConfigurationBusinessLogic logic = new ConfigurationBusinessLogic();

            SourceScheduleEventList sourceScheduleEventList = new SourceScheduleEventList();
            logic.GetSourceScheduleEvents(sourceStation, sourcePipeline, sourceJunction, conflictJunction, interval);

            ConflictScheduleEventList conflictScheduleEventList = new ConflictScheduleEventList();
            logic.GetConflictScheduleEvents(sourceStation, sourcePipeline, sourceJunction, conflictJunction, interval);

            if (sourceScheduleEventList.Items.Count > 0)
                foreach (item in sourceScheduleEventList.Items)


            return (conflictDetailEventList);

Open in new window

Avatar of kaufmed
Flag of United States of America image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial