I have a while loop that publishes certain values into a string, and i a button which should join the values into a string and show that as a message box.
string toDisplay = string.Join("," , Export.ToString());
MessageBox.Show(toDisplay);
However all i get is the internal list not the values. export
the list initiator
List<int> Export = new List<int>();
If Export is a List of int then you don't add ToString() in the Join, just leave the list alone
string toDisplay = string.Join("," , Export);
MessageBox.Show(toDisplay);
If you add the ToString() method to Export variable you are asking the list to give a representation of itself as a string, but the generic List<T>
doesn't have any override for that and use the underlying ToString() from the base object class. This method just outputs the class name.
Instead if you leave just the List variable name Export then the Join method used is the one that enumerate the list elements (integers) and ask them one by one to give a ToString() representation of themselves. Integers can do that.