0
Initalization of dictionary
I tried to create a dictionary : public Dictionary<string, string> TipList{ get { return TipList;} set { TipList = value;} } and when I try to place anything inside the dictionary, it keeps giving a StackOverflow exception.
2 Réponses
+ 5
Your setter is most likely calling TipList which is calling it's setter and an infinite loops occur. Resulting in an overflow.
Try initializing it like this ::
private Dictionary<string, string> TEtipList;
public Dictionary<string, string> TipList
{
get { return TEtipList; }
set { TEtipList = value; }
}
+ 1
show us how you are using it