C# StackOverflowException when use getter -
i have getter wich change first letter of string capital. stackoverflowexception.
namespace consoleapplication1 { class program { class human { public string name { { char[] letters = name.tochararray(); // upper case first char letters[0] = char.toupper(letters[0]); // return array made of new char array return new string(letters); //return name.first().tostring().toupper() + string.join("", name.skip(1)); } set { } }
what wrong?
this line char[] letters = name.tochararray();
calls recursively property public string name
Comments
Post a Comment