I am reading in data from a file into a list. Once I have the data read in, I would like to split every string, and display the length of the split string. I have tried string.Length and string.Count, but nothing works. How can I find the number of elements in my split string?
Here is the section of relevant code:
string fileread = openFileDialog1.Filename; //Opens file from computer
lines = System.IO.File.ReadAllLines(fileread);
foreach (string line in lines)
{
string[] Data_array = line.Split(',');
List<string> Data_list = new List<string>();
Data_list.Add(line);
lbl_datacolumns.Text = Data_array.Count;//should show number of elements in Data_array
}
The error is: "Cannot Convert method group 'Count; to non-delegate type 'string'