开发者

How to determine if an object is a DateTime in VB.NET

开发者 https://www.devze.com 2023-01-21 18:19 出处:网络
The following works fine in c# (assuming value is an object): if (valu开发者_运维技巧e is DateTime)

The following works fine in c# (assuming value is an object):

if (valu开发者_运维技巧e is DateTime)

What is the equivalent check for VB.NET?


The VB.Net equivalent is

If TypeOf(value) Is DateTime Then


C#

if (value.GetType() is typeof(DateTime)) {}

VB.NET (so the converters tell me)

If value.[GetType]() Is GetType(DateTime) Then
    '...
End If


If TypeOf value Is DateTime Then
0

精彩评论

暂无评论...
验证码 换一张
取 消