Questions tagged [addrange]

83 questions
1
vote
0 answers

Iterate through List to another List and run logic

I need to create a scheduling application that will pull information from an Access query that sorts with decending priority and ascending dates to get the order to add and then iterates through the query by rows then columns (down first step then…
nbaylot46
  • 31
  • 2
1
vote
3 answers

AddRange to a list within the same line?

I want to add a range to the list but within the same line as initializing it, I am also just doing a normal add to the list within the same line. Previously was: List dto = new List(); dto.Add(sequence1); dto.AddRange(sequence2);…
JayH
  • 194
  • 1
  • 3
  • 17
0
votes
1 answer

List addrange from Base to inherited type in C#

I have searched, but not found a solution for this. I have made a simple test setup with a List of animals based on the model Animal. I have a new list of giraffes based on the model Giraffe, which is inhereted from Animal. Is it possible to use…
Torben Nygaard
  • 101
  • 1
  • 3
0
votes
1 answer

AddRange and AddRangeAsync of EF doesn't attach entities to the context

I use the following code to insert a collection of entities into by DB using EntityFrameworkCore.SqlServer (7.0.7). I expect that my returned entities are set with an auto generated id which is a int identity(1,1) not null. public async…
Fede
  • 804
  • 1
  • 10
  • 21
0
votes
2 answers

How to add set of records into List

I have two models Stock and Article with StockId as foreign key in Article. I'm trying to add collection of Articles that is equal to Stock.Quantite value to Article model, this is what i use: StockController: public IActionResult AddArticle(int…
user3309231
  • 186
  • 3
  • 20
0
votes
0 answers

How to change the value in List list2 without changing the value in List list1 when using list1.AddRange(list2)?

My code list1.AddRange(list2); foreach (var item in list2) { item.Value--; } when I change the value in list2, the values added to list1 before are also changed how can the value in list1 not be changed?
Anh Đinh
  • 13
  • 2
0
votes
1 answer

Add list of objects using AddRange alongwith modifying value in each object

I am fetching a list of objects from an api but sometimes one of the elements of each object in that list is fetched as null. If that is the case I want to manually add that element since I have that value. This is what I have in mind. var result =…
0
votes
1 answer

C# List.AddRange() very slow

(Problem solved. See my answer bellow.) I just did a profile for my project(winform / C#) because I felt that it worked much slower than before. It is strange that List.AddRange() costs 92% of the total profiling process. Code1: With the following…
cheny
  • 2,545
  • 1
  • 24
  • 30
0
votes
1 answer

Cannot add or insert the item in more than one place - ListView Error

I keep getting an error while attempting to add a range of items into my list view. Error: "Cannot add or insert the item in more than one place" Do keep in mind I have column headers. Here is the example code: private void OtherFunction() { …
Babyhamsta
  • 43
  • 5
0
votes
0 answers

Can't save into input buffer changes range.insertNode(node)

Use selection.addRange(range) for insert html near default text, but this action doesn't save into history of input, and when i use ctrl+z, undo previous action, not change(insertNode) I need, that when I use ctrl+z, action undo detach my html,…
Roman
  • 1
0
votes
0 answers

How to change HttpWebRequest range after getting response?

I am working on a multithread download manager. I want to divide the file into ranges to download with different threads. When a range download is completed I need to divide one of the remaining ranges into two ranges to keep the number of threads…
Ali Tor
  • 2,772
  • 2
  • 27
  • 58
0
votes
0 answers

Why does the addRange function not work in Google Apps Script?

I want to import a graphical evaluation (diagram) into a new file using a macro. So the evaluation should not be inserted on a new sheet in the associated file, but a completely new file should be created, in which the graphical evaluation (in the…
0
votes
2 answers

Argument Exception thrown by Generic.List when using AddRange with an empty Generic.List as argument

In my program I'm getting an unhandled System.ArgumentException when trying to use the AddRange function: Destination Array was not long enough. Check destIndex and length, and the array's lower bounds. When debugging, I break on the exception on…
Jasin Ali
  • 35
  • 5
0
votes
1 answer

How does List.AddRange actually add the range supplied?

I've looked around for a while now and can't seem to find any documentation that covers my concern. I am wondering if I should ever be concerned with the order a range supplied to List.AddRange() is added to the collection. I can assume all day…
Hazel へいぜる
  • 2,751
  • 1
  • 12
  • 44
0
votes
1 answer

C# - Charting - Adding a Range to a Series

Using Microsoft's Charting control, is it possible to add a range of points at once without having to iterate through the List I want to add? I have a List and I need to add the entire list as the Y-values of my Series in the Charting control and…
JToland
  • 3,630
  • 12
  • 49
  • 70