I came across this today in a WCF contract:
[DataMember(IsRequired = true)]
public DateTime? LastModified { get; set; }
What are the consequences of IsRequired = True and a nullable DateTime? They appear to be contradictory to each other.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It can make sense if you want to initialize it with null and let user to set a valid date. So before submitting it can validate user input.
Here is a similar contradictory that may answer your question.
Interaction with IsRequired