ExtensionMethod.NET Home of 875 C#, Visual Basic, F# and Javascript extension methods

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();

Author: kevinjong

Submitted on: 24 mrt 2010

Language: C#

Type: System.Type

Views: 5765