I really think your best bet would be to look at Hashtables, keyed by
DateTime, pointing maybe to ArrayLists of appointments.
As for your ArrayList[] concept, the ArrayList[] itself stands for an array
of ArrayLists, or more precisely, ArrayList references. You would have to
initialize every one of the members, like:
ArrayList[] month = new ArrayList[31];
for (int day = 0; day < 31; day++)
month[day] = new ArrayList();
But as I don't think you'd like to instantiate thousands of ArrayLists in
your calendar, I'd recommend something like the following:
Hashtable calendar = new Hashtable();
ArrayList GetAppointments(DateTime date)
{
date = date.Date; // strip the time part, if any...
ArrayList appointments = calendar[date] as ArrayList;
if (appointments == null)
{
appointments = new ArrayList();
calendar[date] = appointments;
}
return appointments;
}
If you need any more help, you can also contact me directly (remove the blah
from my address)
HTH,
Stefan
"David Sobey" <ma**********@hotmail.com> wrote in message
news:41***********************@news.optusnet.com.a u...
how on earth to i declare and define a static array of ArrayLists? And how
would i pass this to a function. I simply cannot get my code to work:
public struct Event
{
string name;
string UID;
}
ArrayList[] month;
...
public void SetEvents(ArrayList[] list)
{
month = new ArrayList[31];
month = list.Clone();
}
It INSISTS that month is an ArrayList, which it is NOT. It's supposed to
be a static array.