I have a problem with my code, I am supposed to import a list from a .txt file, each line in the txt file has two item, name and city for example
Alex###London
Justin###Texas
I have a code that imports this list from the txt file into the listBox1 but I can not split Alex and London. My class is User and I want to add Alex to name and London to City. this is the code I use but it doesnt work
List<User> userList = new List<User>();
var charArray = listBox1.Text.Split('#' + "#" + "#");
string Name = charArray[0];
string City = charArray[1];
User user = new User(Name, City);
userList.Add(user);