Reputation: 804
When the string[], _lineParts is added to the List, all I see in the List is "System.String[]" What needs to be done to see the actually string[] values in the list.
while (_aLine != null)
{
//split the line read into parts delimited by commas
_lineParts = _aLine.Split(new char[] { ' ', '\u000A', ',', '.', ';', ':', '-', '_', '/' },
StringSplitOptions.RemoveEmptyEntries);
//keep things going by reading the next line
_aLine = sr.ReadLine();
//words = _lineParts;
if (_lineParts != null)
{
//_words.Add(_lineParts.ToString());
wrd.Add(_lineParts.ToString());
}
}
Upvotes: 48
Views: 129869
Reputation: 148180
Use List.AddRange instead of List.Add
Change
wrd.Add(_lineParts.ToString());
To
wrd.AddRange(_lineParts);
Upvotes: 27
Reputation: 172628
You can use List.AddRange()
where you are using List.Add()
Upvotes: 5