本文整理汇总了C#中IGrouping.ElementAt方法的典型用法代码示例。如果您正苦于以下问题:C# IGrouping.ElementAt方法的具体用法?C# IGrouping.ElementAt怎么用?C# IGrouping.ElementAt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IGrouping
的用法示例。
在下文中一共展示了IGrouping.ElementAt方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Select
public PeerSubscription Select(IGrouping<string, PeerSubscription> potentials)
{
int current = -1;
lock (_currentOrdinals)
{
_currentOrdinals.TryGetValue(potentials.Key, out current);
current = (current + 1) % potentials.Count();
_currentOrdinals[potentials.Key] = current;
}
return potentials.ElementAt(current);
}
示例2: CreateStackElement
public StackElement? CreateStackElement(IGrouping<int, string> words, ref char[,] matrix, int wordIndex, int elementI, List<Restriction> restrictions)
{
int wCount = wordIndex;
bool flag = true;
if (restrictions.Count == 0)
{
var word = words.ElementAt(wCount++).ToCharArray();
WriteWord(matrix, elementI, word);
}
else
{
int i = -1;
foreach (var word in words)
{
i++;
if (i < wordIndex)
continue;
flag = true;
var wordArray = word.ToCharArray();
foreach (var restriction in restrictions)
{
if (arr[elementI].orient == Orientation.Horizontal)
{
if (wordArray[restriction.YRestriction - arr[elementI].yorigin] != restriction.Value)
{
flag = false;
break;
}
}
else
{
if (wordArray[restriction.XRestriction - arr[elementI].xorigin] != restriction.Value)
{
flag = false;
break;
}
}
}
if (flag)
{
WriteWord(matrix, elementI, wordArray);
wCount++;
break;
}
wCount++;
}
if (!flag)
return null;
}
return new StackElement { Order = elementI, wordIndex = wCount, Restrictions = restrictions };
}