本文整理汇总了C#中Entities.List.RemoveAt方法的典型用法代码示例。如果您正苦于以下问题:C# List.RemoveAt方法的具体用法?C# List.RemoveAt怎么用?C# List.RemoveAt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Entities.List
的用法示例。
在下文中一共展示了List.RemoveAt方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ListMatches
void ListMatches(List<Team> TeamsBeforeBye)
{
if (TeamsBeforeBye.Count % 2 != 0)
{
TeamsBeforeBye.Add(new Team() {Name = "Bye"});
}
int matchAmmount = (TeamsBeforeBye.Count - 1);
int halfSize = TeamsBeforeBye.Count / 2;
List<Team> teams = new List<Team>();
teams.AddRange(TeamsBeforeBye);
teams.RemoveAt(0);
int teamsSize = teams.Count;
for (int match = 0; match < matchAmmount; match++)
{
Console.WriteLine("Match {0}", (match + 1));
int teamIndex = match % teamsSize;
Console.WriteLine("{0} vs {1}", teams[teamIndex], TeamsBeforeBye[0]);
for (int index = 1; index < halfSize; index++)
{
int firstTeam = (match + index % teamsSize);
int secondTeam = (match + teamsSize - index % teamsSize);
Console.WriteLine("{0} vs {1}", teams[firstTeam], teams[secondTeam]);
}
}
}
示例2: AutoGenerateMatches
public void AutoGenerateMatches()
{
var matches = new List<Match>();
foreach (var item in GeneratedGroups)
{
if (item.Teams.Count % 2 != 0)
{
item.Teams.Add(new Team() { Name = "UnEven"+item.Name, Win = 0, Draw = 0, Loss = 0, Players = new List<Player>() });
}
int numMatch = (item.Teams.Count - 1);
int halfSize = item.Teams.Count / 2;
List<Team> teams = new List<Team>();
teams.AddRange(item.Teams); // Copy all the elements.
teams.RemoveAt(0); // To exclude the first team.
int teamsSize = teams.Count;
for (int match = 0; match < numMatch; match++)
{
string round = (match + 1).ToString();
int teamIdx = match % teamsSize;
matches.Add(new Match() { Round = round, HomeTeam = teams[teamIdx], AwayTeam = item.Teams[0] });
for (int idx = 1; idx < halfSize; idx++)
{
int firstTeam = (match + idx) % teamsSize;
int secondTeam = (match + teamsSize - idx) % teamsSize;
matches.Add(new Match() { Round = round, HomeTeam = teams[firstTeam], AwayTeam = teams[secondTeam] });
}
}
}
GeneratedMatches = matches;
}
示例3: GetVisuals
public List<Equipment> GetVisuals()
{
bool[] equip = new bool[9];
List<Equipment> equips = new List<Equipment>();
List<Equipment> Equipments = GetAllEquips();
for (int i = 0; i < 9; i++)
{
if (!equip[i])
{
Equipment temp = new Equipment();
temp.Slot = (byte)i;
temp.VisualID = 0;
temp.Plus = 0;
temp.Slvl = 0;
temp.RequiredClass = 0;
equips.Add(temp);
}
}
foreach (Equipment i in Equipments)
{
if (i != null)
{
equips.RemoveAt(i.Slot);
equips.Insert(i.Slot, i);
equip[i.Slot] = true;
}
}
return equips;
}
示例4: GetMonths
/// <summary>
/// Method to Get Months from System in Utility Class
/// </summary>
/// <returns>System.Collections.Generic.List</returns>
public static List<string> GetMonths()
{
try
{
string[] months = System.Globalization.DateTimeFormatInfo.InvariantInfo.MonthNames;
List<string> monthList = null;
monthList = new List<string>(months);
monthList.RemoveAt(12);
return monthList;
}
catch (Exception)
{
throw;
}
}