本文整理汇总了C#中Stack.PeekCheckNull方法的典型用法代码示例。如果您正苦于以下问题:C# Stack.PeekCheckNull方法的具体用法?C# Stack.PeekCheckNull怎么用?C# Stack.PeekCheckNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Stack
的用法示例。
在下文中一共展示了Stack.PeekCheckNull方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NeedToTrackBack
private static bool NeedToTrackBack(Description desc, Stack<Iteration> iterations,
Car car, Iteration currentIteration, int maxSteps)
{
var needToTrackBack = iterations.Any() &&
(
iterations.Count >= maxSteps ||
!desc.BoundingBox.IsInside(car.Position) ||
IsAccSumInvalid(iterations.Count, currentIteration.SumAcc, maxSteps) ||
IsWrongCarState(iterations.Count, car, desc, maxSteps) ||
IsCrashWithObstacles(desc.Obstacles, iterations.PeekCheckNull()?.Line)
/* ||
CheckIfTrackForCrossedOldTrack(iterations, currentIteration, car)*/
);
return needToTrackBack;
}
示例2: IsSolution
private static bool IsSolution(Description desc, Car car, Stack<Iteration> iterations)
{
return car.Position == desc.End && car.Speed == Point.Zero && IsCrashWithObstacles(desc.Obstacles, iterations.PeekCheckNull()?.Line);
}