I have this ArrayList that consist of list of structure and I would like to use the content of the ArrayList as the return type for the function bellow. Can anyone help please.
public struct DeviceSchedules
{
public string StartDate;
public string EndDate;
public string Interval;
public string DeviceTimeZone;
public string GLRID;
public string TrackUID;
}
[WebMethod()]
public DeviceSchedules theSchedules()
{
ArrayList ZoneArray = new ArrayList();
ZoneArray.Add("PST");
ZoneArray.Add("MST");
ZoneArray.Add("CST");
ZoneArray.Add("EST");
DeviceSchedules Schedules = new DeviceSchedules();
ArrayList GroupSchedule = new ArrayList();
Int16 Zone = 1;
DateTime Begining = DateTime.Now.AddHours(Zone);
DateTime End = DateTime.Now.AddHours(Zone);
//int Zone = 3;
Int32 TrackID = 9999;
Int32 ScheduleID = 400;
int Frequency = 40;
for (int index = 0; index <= 5; index++)
{
Schedules.StartDate = Convert.ToString(Begining);
Schedules.EndDate = Convert.ToString(End);
Schedules.Interval = Convert.ToString(Frequency);
Schedules.DeviceTimeZone = Convert.ToString(ZoneArray[Zone]);
Schedules.GLRID = Convert.ToString(ScheduleID);
Schedules.TrackUID = Convert.ToString(TrackID);
GroupSchedule.Add(Schedules);
}
return (GroupSchedule);
}