.NET Framework - List<T> newList = new List<T>(MyList.Count + MyOtherList.count);newList.
Asked By Aaron Wang
27-Jan-11 10:11 PM
List<T> newList = new List<T>(MyList.Count + MyOtherList.count);
newList.AddRange(MyList);
newList.AddRange(MyOtherList);
AddRange
(1)
PM
(1)
NewList
(1)
Sems replied to Aaron Wang
All great stuff thanks guys but I should have said that I have to call
the .add method and have to use a Lamba expression.
Peter Duniho replied to Sems
Perhaps you could explain the nature of that requirement. It seems
pretty arbitrary, and it is possible (and if this is real-world code as
opposed to homework, likely) that there are better ways to accomplish
whatever the ultimate goal is here.
Pete

Clear(); } / / / <summary> / / / Initialize the eater listBox / / / < / summary> private void InitEaterType() { lstEaterType.Items.Clear(); lstEaterType.Items.AddRange(Enum.GetNames(typeof(EaterType))); } / / / <summary> / / / Initialize the Gender ListBox / / / < / summary> private void InitGenderType() { lstGender.Items.Clear(); lstGender.Items.AddRange(Enum.GetNames(typeof(GenderType))); } / / / <summary> / / / Initialize the category ListBox / / / < / summary> private void InitCategoryType() { lstCategory.Items Clear(); lstCategory.Items.AddRange(Enum.GetNames(typeof(CategoryType))); } / / / <summary> / / / Initialize the Housing ListBox / / / < / summary> private void InitHousingType() { cboHousing.Items.Clear(); cboHousing.Items.AddRange(Enum.GetNames(typeof(HousingType))); cboHousing.SelectedIndex = 0; } / / Update the GUI ListView by fetching the whole djur kategori / / / < / summary> / / / / / / private void LstCategory_SelectedIndexChanged(object sender, EventArgs e) { lstAnimalType.Items.Clear(); lstAnimalType.Items.AddRange(new Category().GetMyValues(lstCategory.Text).ToArray()); } / / / <summary> / / / The Add button has been activated the following WCFServiceReference.Service1Client(); var authors = new List<DTOAuthor> (); try { var dtoauthors = client.GetAuthors(); client.Close(); authors.AddRange(dtoauthors.Select(dtoauthor = > new DTOAuthor { AuthorID = dtoauthor.AuthorID, FirstName = dtoauthor.FirstName, LastName = dtoauthor.LastName, IsUpdate WCFServiceReference.Service1Client(); var authors = new List<DTOAuthor> (); try { var dtoauthors = client.GetAuthorsWhere(); client.Close(); authors.AddRange(dtoauthors.Select(dtoauthor = > new DTOAuthor { AuthorID = dtoauthor.AuthorID, FirstName = dtoauthor.FirstName, LastName = dtoauthor.LastName, IsUpdate var authors = new List<DTOAuthor> (); try { var dtoauthors = client.SaveAuthors(auths.ToArray()); client.Close(); authors.AddRange(dtoauthors.Select(dtoauthor = > new DTOAuthor { AuthorID = dtoauthor.AuthorID, FirstName = dtoauthor.FirstName, LastName = dtoauthor.LastName, IsUpdate
form I could populate my combobox from an enum by using this statement cboHousing.Items.AddRange(Enum.GetNames(typeof(HousingType))); but it seems that this is not possible in WPF because the combobox does not have an AddRange method. Is the only way to loop through and add each item to the combobox Tony C# Discussions WPF (1) GetValues (1) AddRange (1) GetNames (1) Tony Johansson (1) Combobox (1) You should be able to set the form I could populate my combobox from an enum by using this statement cboHousing.Items.AddRange(Enum.GetNames(typeof(HousingType))); but i
execute a script. thanks. Powershell Discussions ProcessName NPM (1) Virtual Memory (1) Paged Memory (1) PM (1) Memory usage (1) VM (1) I hope the following helps: $ErrorActionPreference = "SilentlyContinue" $Maxmem = 60000000 ProcessName = "Winlogon" $ProcessInfo = get-process -name $ProcessName $NPM = $ProcessInfo.npm #Non Paged Memory(in kilobytes) $PM = $ProcessInfo.pm #Paged Memory(in kilobytes) $WS = $ProcessInfo.ws #Working Set(in kilobytes) $VM = $ProcessInfo.vm #Virtual
artc.Tille, Body = artc.Body }).ToList(); new DataAccessLayer.Article().AddArticles(dtos); } var returndtos = GetArticles(); artcdtos.AddRange(returndtos.Select(dtoArticle = > new DTOArticle { ArticleID = dtoArticle.ArticleID, AuthorID = dtoArticle.AuthorID, Tille = dtoArticle.Tille, Body new PublishingCompanyEntities(conn)) { try { var articles = (from a in db.Articles select a).ToList(); dtos.AddRange(articles.Select(article = > new DTOArticle { ArticleID = article.ArticleID, AuthorID = (int) article.AuthorID, Body = article.Body
list, int count) { if (list.Count < count) { if (list.Capacity < count) { list.Capacity = count; } list.AddRange(Enumerable.Repeat<T> (default(T), list.Count - count)); } } } class StringGrid { private List<List<string> _data