Is there any way to wrtie code to do this:
Foreach property in MyObject;
check to see if property has a DataMember Validator on is with IsRequired=true;
[DataMember(Order = 2, IsRequired=true)]
public string AddressLine1 { get; set; }
[DataMember(Order = 3)]
public string AddressLine2 { get; set; }
If so check if the object has a notNull or empty value in it;
So in summary I create a method called CheckForRequiredFields(object o)
pass it an “Address” object in this case with properties listed above. The code Sees the first property has RequiredField=true so it checks that the Address object passed to it has a value for AddressLine1
Something like (from memory so no guarantees of correctness):