Why doesn\'t this run:
class Program { static void Main(string[] args) { Apple a = new Apple(\"green\"); } } class Apple {
Either add a private setter to your property:
public string Colour{ get; private set;}
Or add a readonly backing-field:
private string _colour; public string Colour{ get return this._colour; } public Apple(string colour) { this._colour = colour; }