c# - List<string[]> displaying list values -


i have code generates list<string[]> variable can't quite figure out how display in text box properly.

list<string[]> test = parsecsv(); (int = 0;  < test.count; i++) {   console.writeline("i = {0}",i);   console.writeline("test[i] = {0}", test[i]);   namelist.text = test[i].tostring() + "\n" + namelist.text; } 

when output test[i] console displays string information correctly, when output test[i] text box get:

system.string[] system.string[] system.string[] system.string[] system.string[] system.string[] 

can tell me i'm doing wrong?

this common misconception tostring shows in variety of situations. not magical formatting wizard, if primitive types appear work "as expect". tostring provides reasonable representation of data @ hand.

in case of array data, obnoxious , incorrect .net output entire array every tostring call (which debugger makes heavy usage of). imagine 3d array of strings 60x60x10. hate have wait on rendered because put mouse on array in debugger.

in case use string.join:

for (int = 0;  < test.count; i++) {     console.writeline("i = {0}",i);     console.writeline("test[i] = {0}", test[i]);     namelist.text = string.join(", ", test[i]) + "\n" + namelist.text; } 

Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -