I am trying to split a string from a text file into an array so that I can store them in a class but it is not working; it doesn't split it, it returns the same format in the textfile.txt
using (StreamReader reader = new StreamReader("textfile.txt"))
{
string line;
while ((line = reader.ReadLine()) != null)
{
char[] delimiters = new char[] { '\t' };
string[] parts = line.Split(delimiters, StringSplitOptions.RemoveEmptyEntries);
for (int i = 0; i < parts.Length; i++)
{
MessageBox.Show(parts[i]);
}
}
}
the text file contains:
George\t15\tStudent\tAddress\tB:\temp\profilepic.png
I want it to look like this (after the split):
George
15
Student
Address
profilepic.png
Any ideas or help appreciated.