Vote count:
0
I'm new to lazy-loading and I've been trying to implement it in my program. However, my program is throwing a StackoverflowException for some reason. I'm not sure how to approach this issue.
public new Field this[int key]
{
get
{
if (!this.Contains(key))
{
Field field = null;
// The loading code of the field + assigning the field object.
this.Add(field);
}
return this[key];
}
}
I do realize the last line this[key]
will just return over and over again, but I'm not sure how to fix it.
asked 23 secs ago
Aucun commentaire:
Enregistrer un commentaire