Questions tagged [addrange]

83 questions
0
votes
1 answer

Using linq to append list to list from select method

I have a collection A of let's say 100 items. From that list I want to perform a where clause which can rule out let's say 20 of items. Is there a way to use Select clause or something else on items in which I could use external method that returns…
Goran Sneperger
  • 77
  • 1
  • 1
  • 8
0
votes
2 answers

AddRange from `await` directly

I am currently returning a list of lists (List>) from await getWorlds() and right now I am looping through each one of them, and getting the first entry in each list. I just wonder if there is another way I can quickly add all of them…
Lee Cheung
  • 101
  • 2
  • 9
0
votes
2 answers

Why i have error result by use IList().toList().AddRange()?

Those are my old Code that cannot response correct result. IList testList=new List(); testList.Add("string1"); var testList2=new List(testList); testList.ToList().AddRange(testList2); I expect there are two elements in…
Moises .Li
  • 45
  • 4
0
votes
1 answer

.Net EF AddRange On List of Objects is Showing as Multiple Queries

It is my understanding that to easily add a list of objects to the database you can add them to a list and then simply call the AddRange followed by the SaveChanges to get this accomplished in one query. We are using a profiler however and seeing it…
DB at PS
  • 111
  • 11
0
votes
0 answers

AddRange doesn't improve time performance when adding items to ListView

I have a list of items. I parse through this list and based on a condition, parse elements from this list and save them in 2 separate lists - listOne and listTwo (of type - ListViewItem). Later, I call AddRange on both of these lists to add them in…
user2769790
  • 123
  • 1
  • 17
0
votes
3 answers

Joining 2 lists with condition

I want to join 2 lists. Students and Persons. Both Student and Person has id and a name variable, plus Student has another variable called isStudying. I want to join all Students to Person with the isStudying variable. var persons = new Person {…
kent
  • 79
  • 2
  • 7
0
votes
0 answers

No output from addrange directories query

I'm having some trouble generating an output in my last for loop. I'm suposed to be generating a list of folders that fit the criteria in the double for loop but black screen is just stuck doesnt even display the press any key to exit messsage. Help…
JPhillips
  • 59
  • 1
  • 5
0
votes
1 answer

How to use LINQ replace a range of nested values in a list?

I'm probably not wording the question correctly, so please help me on the nomenclature. If I have a List which has a constant set of x values, but a variable stream of y values. Right now I have: List points = new…
UndeadBob
  • 1,110
  • 1
  • 15
  • 34
0
votes
1 answer

Entity Framework c#: Bug when AddRange in loop

I have 2 millions of "pb" object instances. I want to add it to my database. Because of memory i splitted list of my objects into a collections of lists and in "for" loop I am trying to add 10'000 of my object instances to database per…
painacle
  • 23
  • 6
0
votes
1 answer

Qt vs C# - List and Vector

I want to ask the following question: Q: What is the difference between AddRange() in C# and Append() in Qt? I read the description for both and in my opinion they are almost identical in there functionality.
Mike
  • 563
  • 5
  • 15
  • 32
0
votes
1 answer

How to save and restore anchorNode/anchorOffset & focusNode/focusOffset?

In the following code: var s=window.getSelection(); var sr=s.getRangeAt(0); console.log(s.anchorOffset+" "+s.focusOffset); s.removeAllRanges(); s.addRange(sr); console.log(s.anchorOffset+" "+s.focusOffset); The anchorOffset and focusOffset are…
poby
  • 1,572
  • 15
  • 39
0
votes
1 answer

Add from one list to another

I have been trying to 'transport' the first two elements from list A to list B without copying them. At the start, list A has four int values. In the end I want List A and B to both have 2 int values. I'm trying something like this: int a = 1; int b…
Turbosheep
  • 183
  • 1
  • 2
  • 13
0
votes
1 answer

List<>.AddRange - where clause

Hi I am working on application to get some details from Sharepoint lists. I am able to get the results as shown below: sample.AddRange(queryResults.GetItemRows().Select(listItemRow => new CalendarEvents { ItemId =…
jats
  • 87
  • 1
  • 1
  • 10
0
votes
1 answer

Add one column of 2D array to listbox using AddRange

I have one 2D array: string[,] table = new string[100,2]; and I want to add the table[,0] to a listbox, something like that listbox1.Items.AddRange(table[,0]); What is the trick to do that? Edit: I want to know if it possible to do that using…
a1204773
  • 6,923
  • 20
  • 64
  • 94
0
votes
3 answers

LINQ - Joining Lists in a linq Query

Question is How do a return a List of B with all the entities in children of all Parents without resorting to the type of code below, I was thinking u must be able to acheive the same within a single linq query? Class Parent { public Title, …
Dan