Depending on how you are going to be using the data, using a collection of objects would be more flexible.
Here is an example of using a collection/list that holds instances of an object. You can bind Lists to forms, etc. so this approach is a practical one if you are going to be displaying the data from the txt file.
public class clsHouse
{
public clsHouse() { }
public clsHouse(string address, decimal cost, string seller)
{
_address = address; _cost = cost; _seller = seller;
}
private string _address = string.Empty;
private decimal _cost = 0;
private string _seller = string.Empty;
public string HouseAddress {
get { return _address; }
set { _address = value; }
}
public decimal HouseCost {
get {return _cost;}
set {_cost = value; }
}
public string ListingAgent
{
get { return _seller; }
set { _seller = value; }
}
}
Now you can populate a collection with "house" objects.
//create the collection
List houses = new List();
clsHouse home = null;
for (int i = 1; i < 50; i++)
{
home = new clsHouse();
home.HouseAddress = (100 + i).ToString() + " Somestreet rd.";
home.HouseCost = Convert.ToDecimal(500000 + ((i + 250) * 1.000));
home.ListingAgent = "Some Person";
houses.Add(home);
}
foreach (clsHouse house in houses)
{
Response.Write(house.HouseAddress);
}
So, if you have a file that contains accounts, and you will have the account name, number, etc.. All of these can be assigned to an object that is type safe (once you convert from string to the proper type) and can access them, manipulate them, implement custom comparers for sorting etc.. Anyway, hope this helps.