VB.NET与C#"var"关键字等效吗? [英] What is the VB.NET equivalent of the C# “var” keyword?

查看:60
本文介绍了VB.NET与C#"var"关键字等效吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如如何使VB.NET 静态键入一个局部变量,使其成为赋值右侧的表达式的 static 类型?

E.g. how do I get VB.NET to statically type a local variable to be the static type of the expression on the right had side of the assignment?

推荐答案

像这样:

Dim myVar = 3

Dim myVar = 3

您还需要

选项推断为

(在文件顶部或在项目设置中)

(At the top of the file or in project settings)

请参见"本地类型推断"

这篇关于VB.NET与C#"var"关键字等效吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆