IsDateTime
Checks whether the type is DateTime.
Source
public static bool IsDateTime(this Type type)
{
return type.Equals(typeof(DateTime));
}
Example
Type type = DateTime.Now.GetType();
bool isString = type.IsDateTime();
ExtensionMethod.NET Home of 880 C#, Visual Basic, F# and Javascript extension methods
Checks whether the type is DateTime.
public static bool IsDateTime(this Type type)
{
return type.Equals(typeof(DateTime));
}
Type type = DateTime.Now.GetType();
bool isString = type.IsDateTime();