是否有与C# var
关键字等效的VB.NET?
我想用它来检索LINQ查询的结果。
发布于 2010-03-19 23:44:48
只需使用不带类型的传统Dim
关键字即可。
最小工作示例:
Option Strict On ' Always a good idea
Option Infer On ' Required for type inference
Imports System
Module MainModule
Sub Main()
Dim i = 42
Dim s = "Hello"
Console.WriteLine("{0}, {1}", i.GetType(), s.GetType())
' Prints System.Int32, System.String '
End Sub
End Module
https://stackoverflow.com/questions/2478552
复制相似问题