简体   繁体   中英

Why infer doesn't work on static but works on dim?

    Static hashTimeDifferrence As HashSet(Of String) = New HashSet(Of String)

works fine

    Static hashTimeDifferrence = New HashSet(Of String)

doesn't

    Dim hashTimeDifferrence2 = New HashSet(Of String)

works because option infer is on.

I think it should work for dim and static.

Is this a bug in vb.net?

There is no fundamental reason why, it is actually just a missed edge case from when Infer was introduced. The former VB PM Anthony Green used it as a reference in how to make breaking changes: https://github.com/dotnet/vblang/issues/312

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM