class Program { static void Main(string[] args) { something s = new something(); s.DoIt(10); Console.Write(s.testCount); } } class something { public int testCount { get { return testCount; } set { testCount = value + 13; } } public void DoIt(int val) { testCount = val; } }
This is what I have because I wanted to test and play with getters / seters stuff for C #. However, I am getting a StackOverFlowException that was unhandled in "set {testCount = value + 13}". And I can not go through it, because I get the message "The debugger cannot continue the process. The process was completed" from Visual Studio. Any ideas what I'm doing wrong?
Edit: Today I found out that I did a pretty dumb derp. Given the many instant answers. Now I know better.
source share