當前位置: 首頁>>代碼示例>>C#>>正文


C# System.Collections.Generic.List.RemoveAt方法代碼示例

本文整理匯總了C#中System.Collections.Generic.System.Collections.Generic.List.RemoveAt方法的典型用法代碼示例。如果您正苦於以下問題:C# System.Collections.Generic.List.RemoveAt方法的具體用法?C# System.Collections.Generic.List.RemoveAt怎麽用?C# System.Collections.Generic.List.RemoveAt使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Collections.Generic.System.Collections.Generic.List的用法示例。


在下文中一共展示了System.Collections.Generic.List.RemoveAt方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: startExit

		//Sets the exit of the start tile (selecting a random one inside the bounds).
		public int startExit (Coordinate coordinate)
		{
		
				int res = 0;
				List<int> allExits = new System.Collections.Generic.List<int> ();
				for (int i =1; i<7; i++) {
						allExits.Add (i); 
				}		
		
		
				while (res == 0) {
			
						int randomVal = (int)Mathf.Floor (Random.Range (0, allExits.Count));
						int possibleExit = allExits [randomVal];
						Coordinate possibleFirstTile = getCoordinateFromExit (coordinate, possibleExit);
			
						if (isOnBounds (possibleFirstTile)) {
								res = possibleExit;
						} else {
								allExits.RemoveAt (randomVal);
						}
				} 
		
		
				return res;
		}
開發者ID:PabloA-C,項目名稱:HexPuzzle,代碼行數:27,代碼來源:AuxMethods.cs

示例2: DoRestart

        void DoRestart()
        {
            System.Collections.Generic.List<string> args =
                new System.Collections.Generic.List<string>();
            var cmds = System.Environment.GetCommandLineArgs();
            foreach (string a in cmds)
                args.Add(a);

            args.RemoveAt(0);
            args.Remove("-restart");

            string sArgs = string.Empty;
            foreach(string s in args)
                sArgs += (s + " ");

            sArgs += " -restart";

            Process.Start("Elpis.exe", sArgs);
        }
開發者ID:CristaliS,項目名稱:Elpis,代碼行數:19,代碼來源:MainWindow.xaml.cs

示例3: RemoveOldBackupFiles

 private static void RemoveOldBackupFiles(string sectionName)
 {
     string[] files = System.IO.Directory.GetFiles(RemoteConfigurationManager.instance.config.LocalApplicationFolder, sectionName + ".*.config");
     if (files.Length > RemoteConfigurationManager.instance.config.MaxBackupFiles)
     {
         System.Collections.Generic.List<string> lst = new System.Collections.Generic.List<string>(files);
         lst.Sort();
         while (lst.Count > RemoteConfigurationManager.instance.config.MaxBackupFiles)
         {
             System.IO.File.Delete(lst[0]);
             lst.RemoveAt(0);
         }
     }
 }
開發者ID:SalarTam,項目名稱:CodeRich,代碼行數:14,代碼來源:RemoteConfigurationManager.cs

示例4: GetSlotOwnerInfo


//.........這裏部分代碼省略.........
                                    listpath = lists[k];
                                    name = Path.GetFileNameWithoutExtension(listpath);
                                }
                            }
                        }

                        //  Lists フォルダから name と listpath を作る
                        DLCData listdata = null;

                        if (listpath == "" && listpaths != null)
                        {

                            // break のためだけの while 文
                            bool found;

                            while (true)
                            {
                                // パスがドンピシャのものを探す
                                found = false;
                                for (int k = 0; k < LCands.Count; k++)
                                {
                                    if (LCands[k].SavePath == brothers[i])
                                    {
                                        found = true;
                                        break;
                                    }
                                }
                                if (found)
                                {
                                    for (int k = 0; k < LCands.Count; k++)
                                    {
                                        if (LCands[k].SavePath != brothers[i])
                                        {
                                            LCands.RemoveAt(k);
                                            LCandPaths.RemoveAt(k);
                                            k--;
                                        }
                                    }
                                    break;
                                }

                                // リストファイルの path のファイル名が brothers[i] のプレフィックスに一致するものを探す
                                // 同時に最大一致文字數を取得

                                int maxlength = 0;
                                found = false;
                                for (int k = 0; k < LCands.Count; k++)
                                {
                                    string listpathfilename = Path.GetFileName(LCands[k].SavePath);
                                    string br = Path.GetFileName(brothers[i]);
                                    //MessageBox.Show(brothers[i] + ", \n" + Path.GetFileName(LCands[k].SavePath) + "\n" + maxlength);

                                    if (listpathfilename.Length > maxlength && listpathfilename == br.Substring(0, Math.Min(listpathfilename.Length, br.Length)))
                                    {
                                        //MessageBox.Show(brothers[i] + ", \n" + Path.GetFileName(LCands[k].SavePath) + "\n" + k);
                                        found = true;
                                        maxlength = listpathfilename.Length;
                                        //break;
                                    }
                                }

                                if (found)
                                {
                                    for (int k = 0; k < LCands.Count; k++)
                                    {
                                        string listpathfilename = Path.GetFileName(LCands[k].SavePath);
開發者ID:riry-sukisuki,項目名稱:DLC-Tool-hogehoge,代碼行數:67,代碼來源:MainForm.cs

示例5: Backtracking

		//Finding a random path.
		public void Backtracking (TileScript newTile, List<TileScript> currentPath)
		{

				//Adding the previous tiles to the new list of tiles.
			
				List<TileScript> newPath = new List<TileScript> (currentPath);

				
			
				//Adding the current tile to the new list.
				newPath.Add (newTile);
		
				if (newPath.Count == pathLenght + 2) {
						// If the path has the desired lenght (plus 1 for the start and 1 for the finish tile,
						//we found the path!

						pathFound = true;
						
	
						completePath = new List<TileScript> (newPath);


				} else {
						//If we didn't find the path yet, we go on.

						//We find the current tile's exit.
						int prevExitPosition = 0; 

						
						if (newPath.Count == 1) {
								//If we are on the first iteration the second tile will be placed at a random exit form the
								//start, within the bounding box. We use the method "startExit()" to find an available one.
				
								prevExitPosition = startExit (newTile.getCoordinates ());
			
						} else {
								//If we are not on the first iteration we can find the next position using the current tile's  
								//coordinates and it's second exit to find it.


								prevExitPosition = newTile.getExits () [1];
						
						}

						//Now that we have the current tile's exit, we can use that information along the coordinate to obtain the
						//coordinate the next tile would have.

						Coordinate nextIterationCoordinate = getCoordinateFromExit (newTile.getCoordinates (), prevExitPosition);

						if (isOnBounds (nextIterationCoordinate) && placeUnused (nextIterationCoordinate, newPath)) {
								//Checking if the next coordinate is on bounds and it's not used already.
				
								
								if (newPath.Count == pathLenght + 1) {
										//If we only have one tile to go, we add the Finish tile.
										TileScript finish = new TileScript (nextIterationCoordinate, "Finish");
										Backtracking (finish, newPath);
					
								} else {
										//We have more than one iteration to go. 

										/*
										We already know that we have a empty slot to place a new tile. We will place one
										at random calling backtracking again. If at any point one branch would not find an
										available path, it'll contenue on the previous branch with more options.

										Once a turn is chosen and the random orientation selected cannot produce a available
										path before going to the other two types of tiles, we try our luck turning to the 
										second possible turn first.
							
										The algorithm will find a branch that suits the desired lenght.
										*/
									
										//Listing all the possible type of tiles.
										List<int> possibleTiles = new System.Collections.Generic.List<int> ();
										
										for (int i = 1; i<4; i++) {
												possibleTiles.Add (i);
										}
										
										while (possibleTiles.Count>0&&!pathFound) {
												//If there is still a type of tile to test on a slot.
							
												/*
												 To improve the execution time, we check if a path was found on a previous 
												attemp. There is repeated code here. That's a bad smell, but i'll be fixed 
												on further refactorizations.
												*/
			
												
												int randomVal = (int)Mathf.Floor (Random.Range (0, possibleTiles.Count));
												int chosen = possibleTiles [randomVal];
												possibleTiles.RemoveAt (randomVal);

										
												if (chosen == 1) {	
								
														//In the Straight tile, we dont mind the left or right orientation.
														TileScript nextTile = new TileScript ("Straight", "Tile " + newPath.Count, nextIterationCoordinate, prevExitPosition, 0);
//.........這裏部分代碼省略.........
開發者ID:PabloA-C,項目名稱:HexPuzzle,代碼行數:101,代碼來源:MapCreator.cs

示例6: mergeMemberC83

        /// <summary>
        /// チェックリストを統合し、string[][]型で返す。
        /// </summary>
        /// <returns></returns>
        private string[][] mergeMemberC83()
        {
            var result = new System.Collections.Generic.List<string[]>();
            var recordCircle = new System.Collections.Generic.List<int>();
            var Color = new Color();

            string[] header = { "Header", "ComicMarketCD-ROMCatalog", "ComicMarket83", "UTF-8", VERSION };
            result.Add(header);

            foreach (ListViewItem item in memberList.Items)
            {
                DataContainer obj = item.Tag as DataContainer;
                if (obj == null) continue;

                for (int i = 0; i < obj.data.GetLength(0); i++)
                {
                    if (obj.data[i][0] != "Circle") continue;
                    try
                    {
                        if (recordCircle.IndexOf(int.Parse(obj.data[i][1])) < 0)
                        {
                            result.Add(obj.data[i]);
                            recordCircle.Add(int.Parse(obj.data[i][1]));
                        }
                        else
                        {
                            int m = recordCircle.IndexOf(int.Parse(obj.data[i][1])) + 1;
                            string[] tmp = result.ToArray()[m];
                            int tmp1 = int.Parse(tmp[2]);
                            int tmp2 = int.Parse(obj.data[i][2]);
                            if (tmp1 == 0) tmp1 = 10;
                            if (tmp2 == 0) tmp2 = 10;
                            if (tmp1 > tmp2)
                                tmp1 = tmp2;
                            if (tmp1 >= 10) tmp1 = 0;
                            tmp[2] = tmp1.ToString();

                            tmp[17] += obj.data[i][17];
                            result.RemoveAt(result.Count);
                            result.Add(tmp);
                        }
                    }
                    catch (Exception) { continue; }
                }
            }

            foreach (Color item in Settings.colorSettings)
            {
                if (item.label == null) continue;
                string[] tmpcolor = { "Color", item.number.ToString(), Color.ToBGRColor(item.checkcolor), Color.ToBGRColor(item.printcolor), item.label };
                result.Add(tmpcolor);
            }

            return result.ToArray();
        }
開發者ID:spring-raining,項目名稱:CNavigating,代碼行數:59,代碼來源:CNavigating.cs


注:本文中的System.Collections.Generic.System.Collections.Generic.List.RemoveAt方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。