本文整理汇总了C#中Line.Min方法的典型用法代码示例。如果您正苦于以下问题:C# Line.Min方法的具体用法?C# Line.Min怎么用?C# Line.Min使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Line
的用法示例。
在下文中一共展示了Line.Min方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Calculate
public void Calculate()
{
{
var x1 = nums[0];
for (int i = 1; i < nums.Count; i++)
{
var x2 = nums[i];
foreach (var x3 in nums.Where(x => x != x1 && x != x2))
{
foreach (var x4 in nums.Where(x => x != x1 && x != x2 && x != x3))
{
var x5 = nums.Find(x => x != x1 && x != x2 && x != x3 && x != x4);
var lines = new Line[5];
lines[0] = new Line(x1, x2);
lines[1] = new Line(x2, x3);
lines[2] = new Line(x3, x4);
lines[3] = new Line(x4, x5);
lines[4] = new Line(x5, x1);
lines[0].Next = lines[1];
lines[1].Next = lines[2];
lines[2].Next = lines[3];
lines[3].Next = lines[4];
lines[4].Next = lines[0];
if(lines.Select(x => x.InnerTotal).Distinct().Count() < 5)
continue;
var min = lines.Min(x => x.InnerTotal);
bool isOk = true;
foreach (var num in all.Except(nums))
{
var first = lines.FirstOrDefault(x => x.InnerTotal + num == min + 10);
if(first == null)
{
isOk = false;
break;
}
first.Insert(num);
}
if(isOk)
{
list.Add(lines);
}
}
}
}
}
}
示例2: GetClosestLineIndex
int GetClosestLineIndex(Line[] lines, Func<Line, float> calcDistance)
{
var minValue = lines.Min(calcDistance);
return Array.FindIndex(lines, c => calcDistance(c) == minValue);
}