本文整理汇总了C#中Entities.List.AddRange方法的典型用法代码示例。如果您正苦于以下问题:C# List.AddRange方法的具体用法?C# List.AddRange怎么用?C# List.AddRange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Entities.List
的用法示例。
在下文中一共展示了List.AddRange方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: FindTest
public List<Test> FindTest(string name)
{
List<Test> tests = new List<Test>();
if (name != null)
tests.AddRange(Db.Read().Where(t => t.Name.Contains(name)));
return tests;
}
示例3: foreach
IList<Page> IVisualStudioService.GetPages(ProjectItems projectItems)
{
List<Page> pages = new List<Page>();
foreach (ProjectItem item in projectItems)
{
pages.AddRange(GetPages(item));
}
return pages;
}
示例4: foreach
IEnumerable<Page> IVisualStudioService.GetPages(ProjectItems projectItems)
{
List<Page> pages = new List<Page>();
foreach (ProjectItem folder in projectItems)
{
if (folder.Name == "Views")
{
pages.AddRange(GetPages(folder, string.Empty));
}
else if (folder.Name == "Areas")
{
foreach (ProjectItem area in folder.ProjectItems)
{
pages.AddRange(GetPages(area, area.Name));
}
}
}
return pages;
}
示例5: GetAllEquips
public List<Equipment> GetAllEquips()
{
List<Equipment> Equipments = new List<Equipment>();
Equipments.AddRange(new Equipment[] { this.Necklace, this.Ring, this.Head, this.Body, this.Hand, this.Cape, this.Feet, this.Charm, this.Mirror });
var equips = Equipments.Where(x => x != null);
return equips.ToList();
}
示例6: AddViewModelAndViews
/// <summary>
/// Adds the view model and views.
/// </summary>
/// <param name="textTemplateInfos">The text template infos.</param>
/// <returns>
/// The messages.
/// </returns>
public IEnumerable<string> AddViewModelAndViews(
IEnumerable<TextTemplateInfo> textTemplateInfos)
{
TraceService.WriteLine("ViewModelViewsService::AddViewModelAndViews");
List<string> messages = new List<string>();
List<TextTemplateInfo> textTemplates = textTemplateInfos.ToList();
messages.AddRange(this.visualStudioService.SolutionService.AddItemTemplateToProjects(textTemplates, this.SettingsService.OutputTextTemplateContentToTraceFile));
//// now add any post action commands
foreach (TextTemplateInfo textTemplateInfo in textTemplates)
{
if (textTemplateInfo.FileOperations != null)
{
foreach (FileOperation fileOperation in textTemplateInfo.FileOperations)
{
this.fileOperationService.ProcessCommand(fileOperation);
foreach (TextTemplateInfo childTemplateInfo in textTemplateInfo.ChildItems)
{
foreach (FileOperation childFileOperation in childTemplateInfo.FileOperations)
{
this.fileOperationService.ProcessCommand(childFileOperation);
}
}
}
}
}
TraceService.WriteLine("ViewModelViewsService::AddViewModelAndViews END");
return messages;
}
示例7: AddViewModelsAndViews
/// <summary>
/// Adds the view models and views.
/// </summary>
/// <param name="views">The views.</param>
/// <returns>A list of views.</returns>
public IEnumerable<string> AddViewModelsAndViews(IEnumerable<View> views)
{
TraceService.WriteLine("ViewModelViewsService::AddViewModelsAndViews");
List<string> messages = new List<string>();
this.visualStudioService.WriteStatusBarMessage(NinjaMessages.AddingViewModelAndViews);
if (this.SettingsService.FrameworkType == FrameworkType.MvvmCrossAndXamarinForms)
{
this.SettingsService.BindXamlForXamarinForms = true;
this.SettingsService.BindContextInXamlForXamarinForms = false;
}
else
{
this.SettingsService.BindXamlForXamarinForms = true;
this.SettingsService.BindContextInXamlForXamarinForms = true;
}
foreach (View view in views)
{
if (view.Existing == false)
{
string viewModelName = view.Name + "ViewModel";
this.visualStudioService.WriteStatusBarMessage(NinjaMessages.AddingViewModelAndViews + " (" + viewModelName + ")");
IEnumerable<TextTemplateInfo> textTemplateInfos = this.viewModelAndViewsFactory.GetRequiredTextTemplates(
view,
viewModelName,
this.viewModelAndViewsFactory.AllowedUIViews,
this.visualStudioService.CoreTestsProjectService != null);
IEnumerable<string> viewModelMessages = this.AddViewModelAndViews(
textTemplateInfos);
messages.AddRange(viewModelMessages);
}
}
TraceService.WriteLine("ViewModelViewsService::AddViewModelsAndViews END");
return messages;
}
示例8: GetMvvmCrossTestsCommands
/// <summary>
/// Gets the MVVM cross tests commands.
/// </summary>
/// <returns>A list of Nuget commands.</returns>
public IEnumerable<string> GetMvvmCrossTestsCommands()
{
TraceService.WriteLine("NugetCommandsService::GetMvvmCrossTestsCommands");
string testingFrameworkNugetPackage = ScorchioMvvmCrossMsTestTests;
switch (this.settingsService.TestingFramework)
{
case TestingConstants.NUnit.Name:
testingFrameworkNugetPackage = ScorchioMvvmCrossNUnitTests;
break;
case TestingConstants.XUnit.Name:
testingFrameworkNugetPackage = ScorchioMvvmCrossXUnitTests;
break;
}
List<string> commands = new List<string>
{
this.GetMvvmCrossCommand(MvvmCrossCore),
this.GetMvvmCrossCommand(MvvmCrossTests),
this.GetNinjaCommand(testingFrameworkNugetPackage, false),
};
IEnumerable<string> testCommands = this.GetTestCommands();
commands.AddRange(testCommands);
return commands;
}
示例9: GetTaskProgress
/// <summary>
/// Bereken de taak voortgang van een sprint.
/// </summary>
/// <param name="sprint"></param>
/// <returns></returns>
public static TaskProgress GetTaskProgress(Sprint sprint)
{
TaskProgress taskProgress = new TaskProgress();
//Dit kan niet in het model, dus loopen, of een List<Task> als argument geven.
// TakenVanSprintQuery takenVanSprintQuery = new TakenVanSprintQuery();
// takenVanSprintQuery.Sprint = sprint;
//
// IList tasks = takenVanSprintQuery.GetQuery(UnitOfWork.CurrentSession).List();
List<Task> tasks = new List<Task>();
if(sprint != null)
{
foreach (SprintStory sprintStory in sprint.SprintStories)
{
tasks.AddRange(sprintStory.Story.Tasks);
}
}
foreach (Task task in tasks)
{
taskProgress.TotalTasks++;
if (task.Status == Status.Afgesloten)
taskProgress.CompletedTasks++;
else
taskProgress.IncompleteTasks++;
if (task.Behandelaar == null)
taskProgress.UnassignedTasks++;
else
taskProgress.AssignedTasks++;
}
return taskProgress;
}
示例10: RetrieveChildren
/// <summary>
/// Gets all the forms that are the children of the folder with the specified ID.
/// </summary>
/// <param name="parentId">The parent ID.</param>
/// <returns>
/// The forms.
/// </returns>
/// <remarks>
/// You can specify a parent ID of null to get the root forms.
/// </remarks>
public IEnumerable<IEntity> RetrieveChildren(Guid? parentId)
{
var children = new List<IEntity>();
children.AddRange(Folders.RetrieveChildren(parentId));
children.AddRange(Forms.RetrieveChildren(parentId));
children.AddRange(Layouts.RetrieveChildren(parentId));
children.AddRange(Validations.RetrieveChildren(parentId));
return children;
}
示例11: GetPages
private IList<Page> GetPages(ProjectItem item, string area)
{
var files = new List<Page>();
if (item.ProjectItems.Count == 0)
{
if (CheckIsPage(item))//check its not an empty folder
{
GetPageData(item, files, area);
}
}
else
{
foreach (ProjectItem currentItem in item.ProjectItems)
{
files.AddRange(GetPages(currentItem, area));
}
}
return files;
}
示例12: GetHangHoaGoiHang
/// <summary>
/// Lấy dữ liệu bảng hàng hóa và gói hàng (Chạy 1 lần để lấy dữ liệu và gán vào biến dùng chung)
/// </summary>
/// <returns></returns>
List<ThongTinMaVach> GetHangHoaGoiHang()
{
List<ThongTinMaVach> dsThongTinMaVachs = new List<ThongTinMaVach>();
try
{
//Lấy MaHangHoa,TenHangHoa,GiaNhap,GiaBanBuon,GiaBanLe,GhiChu từ bảng HÀNG HÓA
cl = new Server_Client.Client();
client = cl.Connect(Luu.IP, Luu.Ports);
ThongTinMaVach row1 = new ThongTinMaVach("Select");
clientstrem = cl.SerializeObj(client, "ThongTinMaVachHangHoa", row1);
ThongTinMaVach[] dsHangHoa = new ThongTinMaVach[0];
dsHangHoa = (ThongTinMaVach[])cl.DeserializeHepper(clientstrem, dsHangHoa);
client.Close();
clientstrem.Close();
if (dsHangHoa != null)
dsThongTinMaVachs.AddRange(dsHangHoa);
}
catch { }
try
{
//Lấy a.GoiHangID,a.MaKho,a.MaGoiHang,a.TenGoiHang,a.MaNhomHang,b.TenNhomHang,a.GiaNhap,a.GiaBanBuon,a.GiaBanLe,a.Deleted
//FROM GoiHang a join NhomHang b on a.MaNhomHang=b.MaNhomHang WHERE a.Deleted='False'
cl = new Server_Client.Client();
client = cl.Connect(Luu.IP, Luu.Ports);
GoiHang goi = new GoiHang("Select");
clientstrem = cl.SerializeObj(client, "GoiHang", goi);
GoiHang[] goiHang = new GoiHang[0];
goiHang = (GoiHang[])cl.DeserializeHepper1(clientstrem, goiHang);
if (goiHang != null)
{
foreach (GoiHang item in goiHang)
{
if (item.Deleted) continue;
ThongTinMaVach row = new ThongTinMaVach
{
MaHangHoa = item.MaGoiHang,
TenHangHoa = item.TenGoiHang,
GiaNhap = item.GiaNhap,
GiaBanBuon = item.GiaBanBuon,
GiaBanLe = item.GiaBanLe
};
dsThongTinMaVachs.Add(row);
}
}
}
catch { }
return dsThongTinMaVachs;
}
示例13: GetProjects
/// <summary>
/// Gets the projects.
/// </summary>
/// <param name="instance">The instance.</param>
/// <returns>The projects.</returns>
public static IEnumerable<Project> GetProjects(this Solution2 instance)
{
////TraceService.WriteLine("SolutionExtensions::GetProjects");
List<Project> projects = instance.Projects.Cast<Project>().ToList();
List<Project> list = new List<Project>();
List<Project>.Enumerator item = projects.GetEnumerator();
while (item.MoveNext())
{
Project project = item.Current;
if (project == null)
{
continue;
}
if (project.Kind == VSConstants.VsProjectKindSolutionItems)
{
list.AddRange(project.GetSolutionFolderProjects());
}
else
{
list.Add(project);
}
}
return list;
}
示例14: Process
/// <summary>
/// Processes the specified form.
/// </summary>
/// <param name="nugetPackagesViewModel">The nuget packages view model.</param>
/// <param name="xamarinFormsLabsViewModel">The xamarin forms labs view model.</param>
internal void Process(
NugetPackagesViewModel nugetPackagesViewModel,
XamarinFormsLabsViewModel xamarinFormsLabsViewModel)
{
TraceService.WriteLine("NugetPackagesController::Process");
this.VisualStudioService.WriteStatusBarMessage(NinjaMessages.NinjaIsRunning);
TraceService.WriteLine("ProjectsController::Process");
string commands = string.Empty;
this.VisualStudioService.WriteStatusBarMessage(NinjaMessages.NinjaIsRunning);
List<string> messages = new List<string>();
if (nugetPackagesViewModel != null)
{
List<Plugin> packages = nugetPackagesViewModel.GetRequiredPackages().ToList();
if (packages.Any())
{
commands += string.Join(
Environment.NewLine,
this.pluginsService.GetNugetCommands(packages, false));
messages.AddRange(this.pluginsService.GetNugetMessages(packages));
}
}
if (xamarinFormsLabsViewModel != null)
{
List<Plugin> plugins = xamarinFormsLabsViewModel.GetRequiredPlugins().ToList();
if (plugins.Any())
{
commands += string.Join(
Environment.NewLine,
pluginsService.GetNugetCommands(plugins, false));
messages.AddRange(this.pluginsService.GetNugetMessages(plugins));
}
}
if (this.SettingsService.OutputNugetCommandsToReadMe)
{
messages.Add(Environment.NewLine);
messages.Add(this.ReadMeService.GetSeperatorLine());
messages.Add(commands);
messages.Add(this.ReadMeService.GetSeperatorLine());
}
this.ReadMeService.AddLines(
this.GetReadMePath(),
"Add Nuget Packages",
messages);
TraceService.WriteHeader("RequestedNugetCommands=" + commands);
if (this.SettingsService.ProcessNugetCommands)
{
this.nugetService.Execute(
this.GetReadMePath(),
commands,
this.SettingsService.SuspendReSharperDuringBuild);
}
this.VisualStudioService.WriteStatusBarMessage(NinjaMessages.NugetDownload);
}
示例15: 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;
}