G
Guest
Hello
I have two classes:
public class ScheduleItem
{
private string s_name;
public ScheduleItem(){ s_name="default";}
public string Name{
get{return s_name;}
set{s_name=value;}
}
}
and the second class:
public class Schedules
{
ScheduleItem[] sched;
private int i_lenght;
public Schedules (int howManyItems)
{
sched= new ScheduleItem[howManyItems];
i_lenght = howManyItems;
}
public int Lenght{ get... set...}
public ScheduleItem this[int idx]
{
get... set.. (here I wrote indexer, it works)
}
}
When I put an instance in my application:
Schedule SCH = new Schedule(2);
SCH[0].Name = "Bill Gates";
i got exception.... why? it should work in my opinion....
I have two classes:
public class ScheduleItem
{
private string s_name;
public ScheduleItem(){ s_name="default";}
public string Name{
get{return s_name;}
set{s_name=value;}
}
}
and the second class:
public class Schedules
{
ScheduleItem[] sched;
private int i_lenght;
public Schedules (int howManyItems)
{
sched= new ScheduleItem[howManyItems];
i_lenght = howManyItems;
}
public int Lenght{ get... set...}
public ScheduleItem this[int idx]
{
get... set.. (here I wrote indexer, it works)
}
}
When I put an instance in my application:
Schedule SCH = new Schedule(2);
SCH[0].Name = "Bill Gates";
i got exception.... why? it should work in my opinion....