my apologize if you do not understand this, as im am very tired as i type.
i am trying to make an Array of "EventItem"'s
i do not know the size i need the array to be so i needed a way to add them which is why i used a arraylist.
but i need to work with the data in the array which means converting out of the arraylist to the object(EventItem) each time i want to use the data. fustrating
so, my solution to which i need help is getting rid of that class which is only an arraylist, and using an indexer for my struct
i just dont understand how the indexers work, ive looked up info but how is it different then just making an array?
please help me understand indexers with the following code :cry:
using System;
using System.Collections;
using System.Data;
namespace skControls
{
public struct EventItem
{
public DateTime eventDate;
public string eventInfo;
public string eventName;
public string eventType;
public EventItem(DateTime dt, string name , string info, string type)
{
eventDate = dt;
eventName = name;
eventInfo = info;
eventType = type;
}
}
public class DayEvents
{
public ArrayList EventList;
public DayEvents()
{
EventList = new ArrayList();
}
public void AddEvent(DateTime dt, string name , string info, string type)
{
EventList.Add(new EventItem(dt,name,info,type));
}
public int EventCount()
{
return EventList.Count;
}