本文整理汇总了C#中Queue.Skip方法的典型用法代码示例。如果您正苦于以下问题:C# Queue.Skip方法的具体用法?C# Queue.Skip怎么用?C# Queue.Skip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Queue
的用法示例。
在下文中一共展示了Queue.Skip方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TryParse
internal static bool TryParse(Node parent, Queue<Word> remainingWords, out PropertyAssignment property)
{
if (remainingWords.Skip(1).First().Text != ":")
{
property = null;
return false;
}
property = new PropertyAssignment(parent);
property.Name = remainingWords.Dequeue().Text;
// remove ':'
remainingWords.Dequeue();
Block block;
if (Block.TryParse(property, remainingWords, out block))
{
property.Value = block;
return true;
}
Expression expression;
if (Expression.TryParse(property, remainingWords, out expression))
{
property.Value = expression;
// remove ';'
if (remainingWords.Peek().Text == ";")
{
remainingWords.Dequeue();
}
return true;
}
property = null;
return false;
}
示例2: Handle
public void Handle(Queue<byte> data)
{
Handler handler;
ushort len;
int consumed = Parse(data.ToArray(), out handler, out len);
while (handler != null)
{
if (handler != null)
{
//Trace.WriteLine(string.Format("BasePacketHandler: Handler:{0} Bytes:{1}, Queue.Count:{2}", handler.Method.Name, len, data.Count()), "Network");
handler(data.Skip(3).Take(len));
}
for (int i = 0; i < consumed && data.Any(); i++)
{
data.Dequeue();
}
consumed = Parse(data.ToArray(), out handler, out len);
}
}
示例3: TryParse
internal static bool TryParse(Node parent, Queue<Word> remainingWords, out MethodCall methodCall)
{
if (remainingWords.Count < 2 ||
remainingWords.Skip(1).First().Text != "(")
{
methodCall = null;
return false;
}
methodCall = new MethodCall(parent);
methodCall.Name = remainingWords.Dequeue().Text;
Parameters parameters;
if (!Parameters.TryParse(methodCall, remainingWords, out parameters))
{
methodCall = null;
return false;
}
methodCall.Parameters = parameters;
return true;
}