I need help learning to validate my objects. I know how to do the validation but I'm wondering where is the best place to put it? I have been told that objects need to validate themself, so should I put the validate inside the accessors?

I have a validation method in my class that forces the class to validate itself before any values are saved to the database, but that method doesn't run until the user tries to save. So there is a good chance that the data in RAM is invalid. I would like to validate earlier then this so that invalid data is not allowed in RAM at all.

I looked on MSDN and found an article. I'm not really sure what this is supposed to do, but I've tried using it in my program and I cannot locate the namespaces. I tried adding them as references but I can't find them anywhere on my computer.

Article

Where should I put my validation to make sure my class is always valid? Even putting them in the accessors seems silly because I have to validate everything twice, once in the accessors and then once when the users try to save.

Thanks.