本文整理汇总了C#中Common.List.Min方法的典型用法代码示例。如果您正苦于以下问题:C# List.Min方法的具体用法?C# List.Min怎么用?C# List.Min使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Common.List
的用法示例。
在下文中一共展示了List.Min方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
private static void Main()
{
int num = Helpers.ValidateInputAsInt("How many numbers you would like to enter: ");
List<double> numbers = new List<double>();
// Fill array with numbers
for (int i = 0; i < num; i++)
{
numbers.Add(Helpers.ValidateInputAsDouble("Enter value " + (i + 1) + ": "));
}
// Use of List methods
Console.WriteLine("Minimal number is : {0}", numbers.Min());
Console.WriteLine("Maximal number is : {0}", numbers.Max());
Console.WriteLine("Sum number is : {0}", numbers.Sum());
Console.WriteLine("Average number is : {0}", numbers.Average());
}
示例2: ResolveType2
private void ResolveType2(RKResults res, IFunctionExecuter fe, out List<double> divT, out List<double> divZ,
out List<double> divZ2, out List<ResPointViewType2> list)
{
var dz1 = new double[res.Count - 1];
for (int i = 1; i < res.Count; i++)
{
dz1[i - 1] = (res[i].Y[0] - res[i - 1].Y[0])/(res[i].X - res[i - 1].X);
}
var dz2 = new double[res.Count - 2];
for (int i = 1; i < dz1.Length; i++)
{
dz2[i - 1] = (dz1[i] - dz1[i - 1])/(res[i].X - res[i - 1].X);
}
var lambda = new int[res.Count - 2];
var valInPoint = new List<double>();
for (int i = 0; i < res.Count - 2; i++)
{
valInPoint.Clear();
for (int j = 0; j < fe.SetCount; j++)
{
valInPoint.Add(Math.Abs(dz2[i] - fe.FunctionSet(res[i].X, res[i].Y, j)));
}
lambda[i] = valInPoint.IndexOf(valInPoint.Min()) + 1;
}
//int g = 0;
int mn = lambda[0];
divZ = new List<double>(); // res[0].Y[0];
divT = new List<double>(); // res[0].X;
divZ2 = new List<double>();
var checkedSet = new List<int>();
for (int i = 1; i < lambda.Length; i++)
{
if (lambda[i] != mn && (checkedSet.Count == 0 || !checkedSet.Contains(lambda[i])))
{
divT.Add((res[i].X + res[i - 1].X)/2f);
divZ.Add((res[i].Y[0] + res[i - 1].Y[0])/2f);
divZ2.Add((res[i].Y[1] + res[i - 1].Y[1])/2f);
checkedSet.Add(mn);
mn = lambda[i];
}
}
//fill DataSouce
list = new List<ResPointViewType2>();
for (int i = 0; i < lambda.Length; i++)
{
list.Add(new ResPointViewType2(res[i].X, res[i].Y[0], res[i].Y[1], lambda[i], -1));
}
}
示例3: SendSolvingResultType1
public void SendSolvingResultType1(RKResults res, IFunctionExecuter fe)
{
var dz = new double[res.Count - 1];
for (int i = 1; i < res.Count; i++)
{
dz[i - 1] = (res[i].Y[0] - res[i - 1].Y[0])/(res[i].X - res[i - 1].X);
}
var lambda = new int[res.Count - 1];
//v[0] = t <= 0 ? -1 : 1
var valInPoint = new List<double>();
for (int i = 0; i < res.Count - 1; i++)
{
valInPoint.Clear();
for (int j = 0; j < fe.SetCount; j++)
{
valInPoint.Add(Math.Abs(dz[i] - fe.FunctionSet(res[i].X, res[i].Y, j)));
}
lambda[i] = valInPoint.IndexOf(valInPoint.Min()) + 1;
}
//int g = 0;
int mn = lambda[0];
var divZ = new List<double>(); // res[0].Y[0];
var divT = new List<double>(); // res[0].X;
var checkedSet = new List<int>();
for (int i = 1; i < lambda.Length; i++)
{
if (lambda[i] != mn && (checkedSet.Count == 0 || !checkedSet.Contains(lambda[i])))
{
divT.Add((res[i].X + res[i - 1].X)/2f);
divZ.Add((res[i].Y[0] + res[i - 1].Y[0])/2f);
checkedSet.Add(mn);
mn = lambda[i];
continue;
}
}
//fill DataSouce
var list = new List<ResPointViewType1>();
for (int i = 0; i < lambda.Length; i++)
{
list.Add(new ResPointViewType1(res[i].X, res[i].Y[0], lambda[i], -1));
}
ShowResultType1(divT, divZ, list, res[0].X, res[res.Count - 1].X);
}