Assuming you have a class Photo:
class Photo { public string Title {get; set;} public string FileExtension {get; set;} public void Save() { // Save to backing store here } }
Which would be the best place to check whether the values have been set correctly. In the propert setter or the Save method.
Edit: What if it is an Update method? If photos are added through a PhotoManager, using a method like PhotoManager.Add(Photo p), then which is the best place to do the validation.
Kind regards,
Don’t let your instances fall into an invalid state: validate right in the setter, that’s what it’s there for.