C# check conversion from List<string> to single string using String.Join, is possible or not? -
i have 1 list<string>
length undefined, , purpose i'm converting entire list<string>
string
, want's check before conversion possible or not(is gonna throw out of memory exception?) can process data , continue in batch.
sample
int drc = importconfiguration.data.count; list<string> queries = new list<string>() { }; //iterate on data row generate query , execute (int drn = 0; drn < drc; drn++)//drn stands data row number { queries.add(generate(importconfiguration.data[drn], drn)); //so here want"s check size //if it"s not possible in next iteration i'll execute right //and emptied list again next batch if (drn == drc - 1 || drn % 5000 == 0) { sqlhelper.executenonquery(connection, system.data.commandtype.text, string.join(environment.newline, queries)); queries = new list<string>() { }; } }
since trying send large amount of text sql server instance, use sql server's streaming support write string stream go, minimizing amount of memory needed construct data send.
very much clarified. I might want to thank you for the endeavors you had made for composing this amazing article. This article roused me to peruse more. Keep it up…
ReplyDeleteAWS Training in Hyderabad