如何确定对象是否是VB.NET中的DateTime

Dan*_*anP 7 vb.net c#-to-vb.net

以下在c#中工作正常(假设valueobject):

if (value is DateTime)
Run Code Online (Sandbox Code Playgroud)

什么是VB.NET的等效检查?

tny*_*fst 17

VB.Net等价物是

If TypeOf(value) Is DateTime Then
Run Code Online (Sandbox Code Playgroud)


Bra*_*rad 9

C#

if (value.GetType() is typeof(DateTime)) {}
Run Code Online (Sandbox Code Playgroud)

VB.NET(所以转换器告诉我)

If value.[GetType]() Is GetType(DateTime) Then
    '...
End If
Run Code Online (Sandbox Code Playgroud)