Last active
December 23, 2015 19:29
-
-
Save sujinlee/6683476 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public bool ValidateData(object data) | |
{ | |
foreach (PropertyInfo propertyInfo in data.GetType().GetProperties()) | |
{ | |
if (propertyInfo.PropertyType == typeof(DateTime) ) | |
{ | |
if (Convert.ToDateTime(propertyInfo.GetValue(data)) == DateTime.MinValue) | |
{ | |
propertyInfo.SetValue(data, DateTime.Now); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment