I am trying to pass a value from special.Day
to intFileDay
depending on the events[]
. For example, if I want to get special.Day value from event[3]......how would I reference that so that I can say intFileDay = event[3].special.Day
??
public List<Event> ExtractData(DateTime dtmDay)
{
int intChosenDay = dtmDay.Day;
int intFileDay;
StreamReader textIn =
new StreamReader(
new FileStream(path, FileMode.OpenOrCreate, FileAccess.Read));
//create the list
List<Event> events = new List<Event>();
string[] lines = File.ReadAllLines(path);
for (int index = 4; index < lines.Length; index += 5)
{
Event special = new Event();
special.Day = Convert.ToInt32(lines[index - 4]);
special.Time = (lines[index - 3]);
special.Price = Convert.ToDouble(lines[index - 2]);
special.StrEvent = lines[index - 1];
special.Description = lines[index];
events.Add(special);
}
textIn.Close();
return events;
}