Duplicate:
New to C#, why does Property Set throw StackOverflow exception?
I have a simple class call myClass that has a property called isAuthenticated with the following code:
public class myClass
{
public myClass()
{
this.isAuthenticated = false;
}
public bool isAuthenticated
{
get { return isAuthenticated; }
set { isAuthenticated = value; }
}
}
When I initalize the class I get a stackoverflow on the set {…} line, what am I doing wrong?
The getter/setter is calling itself. Add a member variable.