本文整理汇总了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;
}
示例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);
}
示例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);
}
}
}
示例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);
示例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);
//.........这里部分代码省略.........
示例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();
}