public string Name
{
get{ return Name; }
}
This property calling itself using with return Name;
. That causes infinite recursion. That's why when you use this property, you get StackOverflowException. I believe the right usage of this property should be:
public string Name
{
get{ return _name; }
}
StackOverflowException is thrown for execution stack overflow errors,
typically in case of a very deep or unbounded recursion.
Starting with the .NET Framework version 2.0, a StackOverflowException
object cannot be caught by a try-catch block and the corresponding
process is terminated by default. Consequently, users are advised to
write their code to detect and prevent a stack overflow. For example,
if your application depends on recursion, use a counter or a state
condition to terminate the recursive loop.