P
Papa.Coen
After repeatedly calling/using a Dictionary I get a
StackOverflowError. What am I doing wrong?
The situation is as follows:
I have ruler class, this class contains some member variables,
encapsulated properties. SOme of those are calculated when get is
called. These kind of properties are actually Cell classes which have
a Calculation class attached. All Cell properties are stored in a
Dictionary <nameEnum, Cell>
When a Cell property is called, the correct Cell is extracted from the
dictionary and asked for its value. This value is calculated once,
every future call returns the previous calculated value.
Cell Property encapsulation:
public decimal PropertyOne
{
get { return this._myCells[Calc.MyName].Calculate(this,
this.helper); }
}
If I use the following code, I do _NOT_ get a stackoverflow error. I
can guess/understand what's going on here, but I'd really like to use
the dictionary:
Cell myCell = new Cell(new Calculator());
public decimal PropertyOne
{
get {return this.myCell.Calculate(this,this.helper);
}
It seems as if each cell is recreated upon retrieval from the
dictionary.......
Who can help me out?
StackOverflowError. What am I doing wrong?
The situation is as follows:
I have ruler class, this class contains some member variables,
encapsulated properties. SOme of those are calculated when get is
called. These kind of properties are actually Cell classes which have
a Calculation class attached. All Cell properties are stored in a
Dictionary <nameEnum, Cell>
When a Cell property is called, the correct Cell is extracted from the
dictionary and asked for its value. This value is calculated once,
every future call returns the previous calculated value.
Cell Property encapsulation:
public decimal PropertyOne
{
get { return this._myCells[Calc.MyName].Calculate(this,
this.helper); }
}
If I use the following code, I do _NOT_ get a stackoverflow error. I
can guess/understand what's going on here, but I'd really like to use
the dictionary:
Cell myCell = new Cell(new Calculator());
public decimal PropertyOne
{
get {return this.myCell.Calculate(this,this.helper);
}
It seems as if each cell is recreated upon retrieval from the
dictionary.......
Who can help me out?