tags:

views:

130

answers:

2

is there a way to do this with automatic properties ?

private IList<string> List;
    public IList<String> list
    {
        get { return List.ToList().AsReadOnly(); }
        set { List = value; }
    }
+9  A: 

No there is not. Automatic properties do little more than wrap simple return and assignment statements around a backing field. The only customization allowed is accessibility. If you want to do anything other than the most basic property, you'll need to use a full property.

JaredPar
A: 

try this

private IList List; public IList list { get { return List.ToList().AsReadOnly(); } private set { List = value; } }

sanjeev