Skip to content

Instantly share code, notes, and snippets.

@sujinlee
Last active December 23, 2015 19:29
Show Gist options
  • Save sujinlee/6683476 to your computer and use it in GitHub Desktop.
Save sujinlee/6683476 to your computer and use it in GitHub Desktop.
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