About 1,650,000 results
Open links in new tab
  1. c# - AddRange to a Collection - Stack Overflow

    Sep 25, 2009 · With AddRange, the collection will be set the capacity and then added the items (faster). This extension method will be extremely slow, but will work. This extension method …

  2. linq - .NET List<T> Concat vs AddRange - Stack Overflow

    Sep 19, 2008 · The big difference is that AddRange mutates that list against which it is called whereas Concat creates a new List. Hence they have different uses. Hence they have different …

  3. Difference between Add and AddRange in arrayList c#

    Jul 14, 2015 · List.Add(), List.AddRange(), List.Insert(), and List.InsertRange() methods are used to add and insert items to a List. AddRange - AddRange adds an entire collection of elements. …

  4. c# - List collection addRange multiple items - Stack Overflow

    Jun 15, 2019 · AddRange takes an IEnumerable, not a single element. One way to handle such scenarios is to wrap your item in an array: One way to handle such scenarios is to wrap your …

  5. What is the difference between AddRange and AddRangeAsync in …

    May 21, 2019 · I am using EF Core to insert entries and I noticed that when I debug this line of code context.MyEntityDbSet.AddRangeAsync(records) it takes a second to load as opposed …

  6. Why is AddRange faster than using a foreach loop?

    Mar 23, 2012 · the AddRange() method will gather all the values it is getting as a "chunk" and add that chunk at once to the specified location. Simply understanding, it is just like you have a list …

  7. Bulk insert using AddRange in Entity framework [closed]

    Oct 27, 2015 · What I was expecting is that by adding the complete collection in context using AddRange method, there would be a single query that will be sent to database. But to my …

  8. C# Adding Multiple Elements to a IList in one line - AddRange not ...

    Sep 9, 2020 · In addition to SelvaS's comment, you can also use List.AddRange(IEnumerable) Method if Cmsentities is already instantiated. it'd look like. Cmsentities.AddRange(new …

  9. c# - Is the List<T>.AddRange () thread safe? - Stack Overflow

    Oct 28, 2010 · As to what can go wrong, think about what AddRange(newItems) does: Check if there is enough space in the internal array; If not: Allocate a new array; Copy the current items …

  10. c# - Why doesn't IList support AddRange - Stack Overflow

    Jul 18, 2012 · So AddRange is an auxiliary and, in a sense, necessary method for dynamic array. But it is completely not necessary for indexed collection, which the IList is. As a conclusion, I …