0

I have a function that checks if a type is a DateTime type:

    public static bool IsDateTime(Type myType)
    {
        return myType is DateTime; // compilation error
    }

but this gives error:

The given expression is never of the provided type ('System.DateTime')

Passing argument 'myType' as object instead of Type would work but I am trying to do it without the need of changing it.

I am using standard ASP.NET Framework 4.5

Willy
  • 9,848
  • 22
  • 141
  • 284

0 Answers0