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


C# Collections.Queue类代码示例

本文整理汇总了C#中System.Collections.Queue的典型用法代码示例。如果您正苦于以下问题:C# Queue类的具体用法?C# Queue怎么用?C# Queue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Queue类属于System.Collections命名空间,在下文中一共展示了Queue类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: NextFigure

 //конструктор
 public NextFigure(INextFigure figure)
 {
     this.figure = figure;
     queue = new Queue<int>();
     rand = new Random();
     queue.Enqueue(rand.Next(0,7));
 }
开发者ID:mazurkostya93,项目名称:Tetris,代码行数:8,代码来源:NextFigure.cs

示例2: Run

		static void Run (Queue q)
		{
			MergeContext context = GetDefaultContext ();
			while (q.Count > 0) {
				string token = (string) q.Dequeue ();

				if (token.Length < 2)
					Usage ();

				if (token [0] == '-' && token [1] == '-') {
					if (token.Length < 3)
						Usage ();

					switch (token [2]) {
					case 'v':
						Version ();
						break;
					case 'a':
						About ();
						break;
					default:
						Usage ();
						break;
					}
				}

				if (token [0] == '-' || token [0] == '/') {
					token = token.Substring (1);

					if (token == "o" || token == "out")
						context.OutputPath = (string) q.Dequeue ();
					else if (token == "e" || token == "exe")
						context.OutputIsExecutable = true;
					else if (token == "d" || token == "dll")
						context.OutputIsExecutable = false;
					else if (token == "L")
						context.NativeLibraries.LibrariesSearchPaths.Add ((string) q.Dequeue ());
					else if (token == "l")
						context.NativeLibraries.Libraries.Add ((string) q.Dequeue ());
					else
						Usage ();
				} else {
					context.Assemblies.Add (token);
					while (q.Count > 0)
						context.Assemblies.Add ((string) q.Dequeue ());
				}
			}

			if (context.Assemblies.Count < 2)
				Error ("At least two assemblies needed");

			if (context.OutputPath == "")
				Error ("Please set output filename");

			context.NativeLibraries.Libraries.Add ("c");
			context.NativeLibraries.LibrariesSearchPaths.Add ("/lib");
			context.NativeLibraries.Initialize ();

			context.Link ();
		}
开发者ID:transformersprimeabcxyz,项目名称:cecil-old,代码行数:60,代码来源:Driver.cs

示例3: Build

 public void Build(object parentObject, Queue<SqlCommand> insertCommands, Queue<SqlCommand> insertLastCommands)
 {
     this.m_InsertSubclassOnly = false;
     Type objectType = parentObject.GetType();
     this.ProcessObjectForInsert(parentObject, objectType, insertCommands, insertLastCommands);
     this.HandlePersistentChildCollections(parentObject, objectType, insertCommands, insertLastCommands);
 }
开发者ID:WilliamCopland,项目名称:YPILIS,代码行数:7,代码来源:InsertCommandBuilder.cs

示例4: WebConnectionGroup

		public WebConnectionGroup (ServicePoint sPoint, string name)
		{
			this.sPoint = sPoint;
			this.name = name;
			connections = new ArrayList (1);
			queue = new Queue ();
		}
开发者ID:GirlD,项目名称:mono,代码行数:7,代码来源:WebConnectionGroup.cs

示例5: Listener

		public Listener(IPEndPoint ipep)
		{
			m_Accepted = new Queue<Socket>();
			m_AcceptedSyncRoot = ((ICollection)m_Accepted).SyncRoot;

			m_Listener = Bind(ipep);

			if (m_Listener == null)
			{
				return;
			}

			DisplayListener();

#if NewAsyncSockets
			m_EventArgs = new SocketAsyncEventArgs();
			m_EventArgs.Completed += new EventHandler<SocketAsyncEventArgs>( Accept_Completion );
			Accept_Start();
            #else
			m_OnAccept = OnAccept;
			try
			{
				IAsyncResult res = m_Listener.BeginAccept(m_OnAccept, m_Listener);
			}
			catch (SocketException ex)
			{
				NetState.TraceException(ex);
			}
			catch (ObjectDisposedException)
			{ }
#endif
		}
开发者ID:Crome696,项目名称:ServUO,代码行数:32,代码来源:Listener.cs

示例6: reset

 /// <summary>
 /// Call to reset from a previous run of the spider
 /// </summary>
 public void reset()
 {
     m_already = new Hashtable();
     //?从本地导入索引文件
     m_workload = new Queue();
     m_quit = false;
 }
开发者ID:kakake,项目名称:KindleSpider,代码行数:10,代码来源:SpiderWorker.cs

示例7: ReversePolishNotationEvaluator

        public ReversePolishNotationEvaluator()
        {
            output = new Queue();
            ops = new Stack();

            postfixExpression = string.Empty;
        }
开发者ID:BlueForeverI,项目名称:ExpressionCalculator,代码行数:7,代码来源:ReversePolishNotationEvaluator.cs

示例8: WebConnectionGroup

		public WebConnectionGroup (ServicePoint sPoint, string name)
		{
			this.sPoint = sPoint;
			this.name = name;
			connections = new LinkedList<ConnectionState> ();
			queue = new Queue<HttpWebRequest> ();
		}
开发者ID:henricj,项目名称:SM.Mono.Net,代码行数:7,代码来源:WebConnectionGroup.cs

示例9: PriorityQueue

 public PriorityQueue()
 {
     for(int i = 0; i < _queues.Length; ++i)
     {
         _queues[i] = new Queue();
     }
 }
开发者ID:BackupTheBerlios,项目名称:seleon,代码行数:7,代码来源:PriorityQueue.cs

示例10: BulletPool

        public BulletPool()
        {
            if(this.Capacity.Equals(null))
                this.Capacity = 32;

            this.queue = new Queue(Capacity);
        }
开发者ID:is25,项目名称:DesignPattern.Samples,代码行数:7,代码来源:Program.cs

示例11: Player

        public Player(TcpClient client, string ip, byte id)
        {
            try
            {
                this.username = "player";
                this.plyClient = client;
                this.x = 0;
                this.y = 0;
                this.z = 0;
                this.rotx = 0;
                this.roty = 0;
                this.prefix = "";
                this.id = id;
                this.ip = ip;

                this.world = null;

                this.outQueue = new Queue<Packet>();
                this.blockQueue = new Queue<Packet>();
                this.IOThread = new Thread(PlayerIO);
                this.outputWriter = new BinaryWriter(client.GetStream());
                this.inputReader = new BinaryReader(client.GetStream());

                this.IOThread.IsBackground = true;
                this.IOThread.Start();
            }
            catch
            {
            }
        }
开发者ID:roy12345,项目名称:uMiner,代码行数:30,代码来源:Player.cs

示例12: DrawSnakeElement

 private static void DrawSnakeElement(Queue<Position> inputQueue)
 {
     foreach (Position curentElementPosition in inputQueue)
     {
         DrawSingleElement(curentElementPosition, "*");
     }
 }
开发者ID:NikolayNanev,项目名称:SnakeGameCSharp,代码行数:7,代码来源:ProgramMain.cs

示例13: StartSniffing

        public bool StartSniffing(LivePcapDevice deviceToSniff)
        {
            try
            {
                device = deviceToSniff;

                // Open the device for capturing
                int readTimeoutMilliseconds = 1000;
                //device.StopCaptureTimeout = new TimeSpan(0, 1, 0);
                device.Open(DeviceMode.Promiscuous, readTimeoutMilliseconds);
                device.SetFilter(GetFilterExpression());

                packetQueue = new Queue();

                sniffingThread = new Thread(new ThreadStart(SnifferLoop));
                sniffingThread.Name = "Sniffing Thread";
                sniffingThread.IsBackground = true;
                sniffingThread.Start();

                decodingThread = new Thread(new ThreadStart(DecoderLoop));
                decodingThread.Name = "Decoding Thread";
                decodingThread.IsBackground = true;
                decodingThread.Start();

                Log("Sniffing started");
            }
            catch (Exception e)
            {
                Log(e.ToString());
                return false;
            }

            return true;
        }
开发者ID:devinvisible,项目名称:D2Smells2,代码行数:34,代码来源:PacketSniffer.cs

示例14: getTypes

        private static IEnumerable<Type> getTypes(Type sourceType)
        {
            Queue<Type> pending = new Queue<Type>();
            HashSet<Type> visited = new HashSet<Type>();
            pending.Enqueue(sourceType);

            while (pending.Count != 0)
            {
                Type type = pending.Dequeue();
                visited.Add(type);
                yield return type;

                if (type.BaseType != null)
                {
                    if (!visited.Contains(type.BaseType))
                    {
                        pending.Enqueue(type.BaseType);
                    }
                }

                foreach (Type interfaceType in type.GetInterfaces())
                {
                    if (!visited.Contains(interfaceType))
                    {
                        pending.Enqueue(interfaceType);
                    }
                }
            }
        }
开发者ID:khoaho,项目名称:mustache-sharp,代码行数:29,代码来源:UpcastDictionary.cs

示例15: Start

        public IEnumerator Start()
        {
            pool = new InventoryPool<InventoryUIItemWrapper>(wrapperPrefab, 8);
            queue = new Queue<ItemHolder>(8);
            destroyTimer = new WaitForSeconds(slideAnimation.length - 0.025f);
            offsetTimer = new WaitForSeconds(offsetTimerSeconds);

            foreach (var inv in InventoryManager.GetLootToCollections())
            {
                inv.OnAddedItem += (items, amount, cameFromCollection) =>
                {
                    if (cameFromCollection == false)
                    {
                        queue.Enqueue(new ItemHolder() { item = items.FirstOrDefault(), stackSize = amount});
                    }
                };
            }

            while (true)
            {
                if (queue.Count > 0)
                {
                    ShowItem(queue.Peek().item, queue.Peek().stackSize);
                    queue.Dequeue(); // Remove it
                }

                yield return offsetTimer;
            }
        }
开发者ID:predominant,项目名称:Treasure_Chest,代码行数:29,代码来源:InventoriesItemReceiverUI.cs


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