当前位置: 首页>>代码示例>>C#>>正文


C# Queue.Each方法代码示例

本文整理汇总了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));
        }
开发者ID:MassTransit,项目名称:MassTransit-Stomp,代码行数:10,代码来源:StompSubscriptionService.cs

示例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);
                          });
        }
开发者ID:MassTransit,项目名称:MassTransit-Stomp,代码行数:18,代码来源:StompSubscriptionService.cs

示例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));
            }
        }
开发者ID:KevM,项目名称:fubumvc,代码行数:19,代码来源:SharingDslReader.cs

示例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);
            }
        }
开发者ID:RobertTheGrey,项目名称:fubumvc,代码行数:65,代码来源:ScriptDslReader.cs

示例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));
            }
        }
开发者ID:KevM,项目名称:fubumvc,代码行数:12,代码来源:SharingDslReader.cs


注:本文中的Queue.Each方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。