C# get and set properties for a List Collection
<p>How are properties for a Collection set?</p>

<p>I've created a class with a Collection properties. I want to add to the List anytime I set a new value. Using _name.Add(value) within the set method doesn't work.</p>

<pre><code>Section newSec = new Section();

newSec.subHead.Add("test string");
newSec.subHead.Add("another test string");

public class Section
{
    public String head { get; set; }
    private List&lt;string&gt; _subHead = new List&lt;string&gt;();
    private List&lt;string&gt; _content = new List&lt;string&gt;();

    public List&lt;string&gt; subHead
    {
        get
        { return _subHead; }
        set
        {
            _subHead.Add(value);
        }
    }
    public List&lt;string&gt; content
    {
        get
        { return _content; }
        set
        {
            _content.Add(value);
        }
    }
}
</code></pre>

<p>Update with my solution:</p>

<pre><code>public class Section
{

    private List&lt;string&gt; _head = new List&lt;string&gt;();
    private List&lt;string&gt; _subHead = new List&lt;string&gt;();
    private List&lt;string&gt; _content = new List&lt;string&gt;();

    public List&lt;string&gt; Head
    {
        get
        { return _head; }
    }

    public List&lt;string&gt; SubHead
    {
        get
        { return _subHead; }
    }
    public List&lt;string&gt; Content
    {
        get
        { return _content; }
    }

    public void AddHeading(string line)
    {
        Head.Add(line);
    }

    public void AddSubHeading(string line)
    {
        SubHead.Add(line);
    }

    public void AddContent(string line)
    {
        Content.Add(line);
    }

}
</code></pre>
