You're calling the getter and setter recursively (calling themselves infinitely), inevitably causing a stack overflow.
Surely this is what you mean to be doing:
private string headline;
public string Headline
{
get { return headline; }
set { headline = value; }
}
Note that this is unnecessary if you don't plan to introduce any further get/set logic, as this is exactly what your first example does behind the scenes.
When learning about properties in c#, it helps to think of them not as data, but as a pair of methods with the following signatures:
public string get_Headline() { ... }
public void set_Headline(string value) { ... }
In fact, this is exactly how the compiler defines them.
Now it's easy to see that your initial code would call set_Headline
recursively.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…