本文整理汇总了C#中Queue.Each方法的典型用法代码示例。如果您正苦于以下问题:C# Queue.Each方法的具体用法?C# Queue.Each怎么用?C# Queue.Each使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Queue
的用法示例。
在下文中一共展示了Queue.Each方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Stop
/// <summary>
/// Stops this instance.
/// </summary>
public void Stop()
{
var transports = new Queue<StompTransport>();
transports.Enqueue(_bus.Endpoint.InboundTransport as StompTransport);
transports.Each(transport => transport.StompClient.Unsubscribe(transport.Address.Uri.PathAndQuery));
}
示例2: Start
/// <summary>
/// Starts the specified bus.
/// </summary>
/// <param name = "bus">The bus.</param>
public void Start(IServiceBus bus)
{
_bus = bus;
var transports = new Queue<StompTransport>();
transports.Enqueue(_bus.Endpoint.InboundTransport as StompTransport);
transports
.Each(transport =>
{
transport.StompClient.Subscribe(transport.Address.Uri.PathAndQuery);
WaitForSubscriptionConformation(transport.StompClient, transport.Address.Uri.PathAndQuery);
});
}
示例3: readExport
private void readExport(Queue<string> queue, string verb, string provenance)
{
switch (verb)
{
case "to":
if(queue.Contains("all"))
{
_registration.Global(provenance);
break;
}
queue.Each(importer => _registration.Dependency(importer, provenance));
break;
default:
throw new InvalidSyntaxException(invalidVerb(verb));
}
}
示例4: ReadLine
public void ReadLine(string text)
{
if (text.Trim().StartsWith("#")) return;
var tokens = new Queue<string>(StringTokenizer.Tokenize(text.Replace(',', ' ')));
if (tokens.Count == 1)
{
if (_readerAction == null)
{
throw new InvalidSyntaxException("Not enough tokens in the command line");
}
_readerAction(tokens.First());
return;
}
_lastName = null;
_readerAction = null;
if (tokens.Count() < 3)
{
throw new InvalidSyntaxException("Not enough tokens in the command line");
}
var key = tokens.Dequeue();
var verb = tokens.Dequeue();
if (key == "ordered")
{
handleOrderedSet(tokens, verb);
return;
}
switch (verb)
{
case "is":
if (tokens.Count > 1) throw new InvalidSyntaxException("Only one name can appear on the right side of the 'is' verb");
_registration.Alias(tokens.Dequeue(), key);
break;
case "requires":
tokens.Each(name => _registration.Dependency(key, name));
break;
case "extends":
if (tokens.Count > 1) throw new InvalidSyntaxException("Only one name can appear on the right side of the 'extends' verb");
_registration.Extension(key, tokens.Single());
break;
case "includes":
tokens.Each(name => _registration.AddToSet(key, name));
break;
case "preceeds":
tokens.Each(name => _registration.Preceeding(key, name));
break;
default:
string message = "'{0}' is an invalid verb".ToFormat(verb);
throw new InvalidSyntaxException(message);
}
}
示例5: readImport
private void readImport(Queue<string> queue, string verb, string provenance)
{
switch (verb)
{
case "from":
queue.Each(export => _registration.Dependency(provenance, export));
break;
default:
throw new InvalidSyntaxException(invalidVerb(verb));
}
}