本文整理汇总了C#中System.Collections.Generic.System.Collections.Generic.List.Intersect方法的典型用法代码示例。如果您正苦于以下问题:C# System.Collections.Generic.List.Intersect方法的具体用法?C# System.Collections.Generic.List.Intersect怎么用?C# System.Collections.Generic.List.Intersect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Collections.Generic.System.Collections.Generic.List
的用法示例。
在下文中一共展示了System.Collections.Generic.List.Intersect方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: stitchUnRestrictedSubCalendarEvent_NonAggressive
//.........这里部分代码省略.........
bool breakForLoop = false;
bool PreserveRestrictedIndex = false;
for (; FrontPartialCounter < ListOfFrontPartialsStartTime.Count; FrontPartialCounter++)//for loop tries to prioritize the front partial elements as the boundary of the calculation of fittable elements.
{
TimeLineUpdated = null;
DateTime PertinentFreeSpotStart = EarliestReferenceTIme;
DateTime PertinentFreeSpotEnd;
if ((ListOfFrontPartialsStartTime[FrontPartialCounter] < RestrictedStopper))
{
PertinentFreeSpotEnd = ListOfFrontPartialsStartTime[FrontPartialCounter];
ListOfFrontPartialsStartTime.RemoveAt(FrontPartialCounter);
--FrontPartialCounter;
PreserveRestrictedIndex = true;
}
else
{
PertinentFreeSpotEnd = RestrictedStopper;
if (breakForLoop)
{//this allows for the population or insertion of the restrictedSnugFitAvailable[i]. Within the enclosing for loop the restrictedSnugFitAvailable[i] never gets appended until this point.
PertinentFreeSpot = new TimeLine(PertinentFreeSpotStart, PertinentFreeSpotEnd);
BorderElementBeginning = CompleteArranegement.Count > 0 ? CompleteArranegement[CompleteArranegement.Count - 1] : null;//Checks if Complete arrangement has partially being filled. Sets Last elements as boundary Element
BorderElementEnd = restrictedSnugFitAvailable[i].Item2;//uses restricted value as boundary element
restOfrestrictedSnugFitAvailable = new List<mTuple<bool, SubCalendarEvent>>();
for (int q = i; q < restrictedSnugFitAvailable.Count; q++)
{
restOfrestrictedSnugFitAvailable.Add(restrictedSnugFitAvailable[q]);
}
selectedRestrictedElements = LowestCostArrangement.Intersect(restOfrestrictedSnugFitAvailable.Select(obj => obj.Item2));
if (selectedRestrictedElements.Count() > 0)
{
if (selectedRestrictedElements.Contains(restrictedSnugFitAvailable[i].Item2))
{
ignorePlaceRestrictedinBestPosition = true;//forces the call to PlaceSubCalEventInLowestCostPosition to be ignored. THis is needed if one of the elements in selected restricted elements is the current restrictedSnugFitAvailable
}
restrictedSnugFitAvailable.RemoveAll(obj => selectedRestrictedElements.Contains(obj.Item2));
}
LowestCostArrangement = OptimizeArrangeOfSubCalEvent_NonAggressive(PertinentFreeSpot, new Tuple<SubCalendarEvent, SubCalendarEvent>(BorderElementBeginning, BorderElementEnd), CompatibleWithList.Values.ToList(), PossibleEntries_Cpy, restOfrestrictedSnugFitAvailable, Occupancy);
//LowestCostArrangement = OptimizeArrangeOfSubCalEvent_NonAggressive(PertinentFreeSpot, new Tuple<SubCalendarEvent, SubCalendarEvent>(BorderElementBeginning, BorderElementEnd), CompatibleWithList.Values.ToList(), PossibleEntries_Cpy, restrictedSnugFitAvailable,Occupancy);
DateTime EarliestTimeForBetterEarlierReferenceTime = PertinentFreeSpot.Start;
LastSubCalElementForEarlierReferenceTime = ((CompleteArranegement.Count < 1) || (CompleteArranegement == null) ? null : CompleteArranegement[CompleteArranegement.Count - 1]);
FreeSpotUpdated = PertinentFreeSpot.CreateCopy();
if (LowestCostArrangement.Count > 0)
{
if (!(LowestCostArrangement[0].getCalendarEventRange.Start == PertinentFreeSpot.Start))//Pin SubEvents To Start
{//if the first element is not a partial Sub Cal Event element
FreeSpotUpdated = new TimeLine(EarliestReferenceTIme, PertinentFreeSpot.End);
Utility.PinSubEventsToStart(LowestCostArrangement, FreeSpotUpdated);
}
else
{
FreeSpotUpdated = PertinentFreeSpot.CreateCopy();// new TimeLine(LowestCostArrangement[0].getCalendarEventRange.Start, PertinentFreeSpot.End);
Utility.PinSubEventsToStart(LowestCostArrangement, PertinentFreeSpot);
}
EarliestReferenceTIme = PertinentFreeSpot.End;// LowestCostArrangement[LowestCostArrangement.Count - 1].End;