开发者

What is this "Of Date" in VB?

I have a functio开发者_如何学运维n which excepts a string and Of Date is passed. What is that?

myfunc(Of Date)() 


As mentioned in a comment to your question, this is not vb6, and can never be used in vb6; it's VB.Net, which is really a whole new language. The code uses a feature that is not available in vb6: generics. There is nothing even close to this feature available for vb6.

In this case, (Of Date) is not the argument list for the function parameters. It's the argument list for the type parameters of a generic function. The keyword "Of" indicates it's a type list and "Date" means the type for this call will be Date. The parameter argument list comes after the type argument list. So if the function accepts a string parameter, you should call it like this:

myfunc(Of Date)("7/6/2011")

Because it's a generic function, you could also call it like this:

myfunc(Of Integer)("12345")

Though whether either of those calls has any meaning depends on the body of the function.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜