A
almurph
Hi,
I'm trying to approximate a simple collection property in C#. Yes, I
know C# does not allow parameterized properties. you have implement a
poroperty opf this type either as an inxer or as a pair of methods. I
choose the second optuion and the code is below:
**** CODE AS FOLLOWS *****
private ArrayList mBranch = new ArrayList();
public Tree GetBranch(int I)
{
return (Tree)mBranch;
}
public void SetBranch(int I, Tree T)
{
mBranch = T;
}
*** EIND CODE ****
The problem is though, it does not work. To be specific the "SetBranch
()" method does not work. When i send something down the get the
following error message:
"Index was out of range. Must be non-negative and less than the size
of the collection.
Parameter name: index"
Would appreciate any comments/suggestions/corrections as tyo why this
is occuring. I'm at my wits end.
Thanks,
Al.
I'm trying to approximate a simple collection property in C#. Yes, I
know C# does not allow parameterized properties. you have implement a
poroperty opf this type either as an inxer or as a pair of methods. I
choose the second optuion and the code is below:
**** CODE AS FOLLOWS *****
private ArrayList mBranch = new ArrayList();
public Tree GetBranch(int I)
{
return (Tree)mBranch;
}
public void SetBranch(int I, Tree T)
{
mBranch = T;
}
*** EIND CODE ****
The problem is though, it does not work. To be specific the "SetBranch
()" method does not work. When i send something down the get the
following error message:
"Index was out of range. Must be non-negative and less than the size
of the collection.
Parameter name: index"
Would appreciate any comments/suggestions/corrections as tyo why this
is occuring. I'm at my wits end.
Thanks,
Al.