本文整理汇总了C#中ConcurrentStack.ElementAt方法的典型用法代码示例。如果您正苦于以下问题:C# ConcurrentStack.ElementAt方法的具体用法?C# ConcurrentStack.ElementAt怎么用?C# ConcurrentStack.ElementAt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConcurrentStack
的用法示例。
在下文中一共展示了ConcurrentStack.ElementAt方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Validate_Solutions
private void Validate_Solutions(double Removal_Ratio)
{
Solution_List_Threading = new ConcurrentStack<Solution>() { };
List<Solution> Holder = new List<Solution>() { };
count = Convert.ToInt32(Solution_List.Count * (1 - Removal_Ratio));
int Count_Original = count;
for (int n = 0; n < Count_Original; n++)
{
using (e = new CountdownEvent(NumberOfThreads))
{
for (int i = 0; i < NumberOfThreads; i++)
{
ThreadPool.QueueUserWorkItem(new WaitCallback(Validate_Solutions), i);
}
e.Wait();
}
int max = -1;
int mx = -1;
for (int i = 0; i < Solution_List_Threading.Count; i++)
{
if (max < Solution_List_Threading.ElementAt(i).Unknowns_Sum)
{
max = Solution_List_Threading.ElementAt(i).Unknowns_Sum;
mx = i;
}
}
Holder.Add(new Solution(Solution_List_Threading.ElementAt(mx)));
Solution_List_Threading.Clear();
Solution_List.RemoveAt(mx);
count = Convert.ToInt32(Solution_List.Count * (1 - Removal_Ratio));
}
Solution_List = new List<Solution>(Holder); Holder.Clear();
}