I have the following:
namespace Test {
public class Location {
public string city { get; set; }
}
public class BaseViewModel {
public BaseViewModel() {
Location = new Location { city = "Paris"; };
}
public Location Location { get; set; }
}
public class EditViewModel : BaseViewModel {
public Book Book { get; set; }
Location = "France";
}
}
This seem like a strange requirement but how can I set the value of Location from within the EditViewModel? The line below gives the following error:
Location = "France";
Error 2 Invalid token '=' in class, struct, or interface member declaration
Add a constructor.
or better add a specialized constructor and a default constructor:
just to be precise, don’t use string, use your Object, I’ve used string for quickening.