Skip to content

Instantly share code, notes, and snippets.

@JoseGonzalez321
Last active January 19, 2016 19:33
Show Gist options
  • Save JoseGonzalez321/29f6b10594b19ffa7d79 to your computer and use it in GitHub Desktop.
Save JoseGonzalez321/29f6b10594b19ffa7d79 to your computer and use it in GitHub Desktop.
Simple validation for parameter types
private static bool AreParamsValid(object[] parameters)
{
if (parameters == null || parameters.Length == 0)
return false;
var result = true;
parameters.ForEach(p =>
{
if (p is string)
{
if (string.IsNullOrEmpty(p as string))
result = false;
}
else if (p is DateTime)
{
var dateTime = (DateTime)p;
if (dateTime.equals(DateTime.Min))
result = false;
}
});
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment