c# - How can I join strings from one List<string> into another one? -


i've got list<string> names;, has 700 000 names in it. how can join every 500 strings (using separator ",") , add them new list<string> abc;

so want have 1 list<string>, hold 1400 joined strings.

abc[0]= first 500 names, abc[1]= next 500 names , on.

with morelinq batch (or any other batch implementation):

var abc = names.batch(500).select(x => string.join(",", x)).tolist(); 

note: grouping operator not streaming operator (as tolist). means 700k strings should enumerated , keys should calculated each item, , each items should stored in internal groups. , cost time , resources. batching streaming , not store items internally. stores current batch. batching if not convert results list, can process batches 1 one faster , save memory.


Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -