A
almurph
Hi,
I have a class called "Tree" which contains several exposed
properties and an indexer. The indexer is defined to be as follows:
***** BEGIN CODE *****
private Tree[] mBranch;
public Tree this[int index]
{
get
{
return mBranch[index];
}
set
{
mBranch[index] = value;
}
}
**** END CODE ****
The system is giving me a wrning under mBranch that says:
"Tree.mBranch' is never assigned to, and will always have its default
value null"
When i try to send somethign down to the indexer, like this:
Node = ATree;
I get the error message "Object reference not set to an instance of
an object." as mBranch is indeed null.
Just wonderting is there any ways around this. I would appreciate any
suggestions/comments/ideas/calternatives/improvements/code-sampels
that you may be able to offer.
Thanks,
Al.
I have a class called "Tree" which contains several exposed
properties and an indexer. The indexer is defined to be as follows:
***** BEGIN CODE *****
private Tree[] mBranch;
public Tree this[int index]
{
get
{
return mBranch[index];
}
set
{
mBranch[index] = value;
}
}
**** END CODE ****
The system is giving me a wrning under mBranch that says:
"Tree.mBranch' is never assigned to, and will always have its default
value null"
When i try to send somethign down to the indexer, like this:
Node = ATree;
I get the error message "Object reference not set to an instance of
an object." as mBranch is indeed null.
Just wonderting is there any ways around this. I would appreciate any
suggestions/comments/ideas/calternatives/improvements/code-sampels
that you may be able to offer.
Thanks,
Al.