无法在visual studio intellisence中看到var数据类型 [英] cant see var datatype in visual studio intellisence

查看:189
本文介绍了无法在visual studio intellisence中看到var数据类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿伙计们

我不能用我的方法定义var数据类型,任何人都知道为什么?

Hey guys
I cant define var datatype uder my method , anybody knows why ?

推荐答案

C# var 根本不是一种类型。你无法在Intellisense中找到它。这是一个关键字,它作为变量声明中类型的占位符,并且仅在实际类型可以从初始化表达式推断的情况下。要了解它的工作原理,您应该了解类型推断 http:// msdn.microsoft.com/en-us/vstudio/jj131514.aspx [ ^ ]。



-SA
C# "var" is not a type at all. You cannot find it in Intellisense. This is a keyword which serves as a placeholder of the type in a variable declaration, and only in the case when the actual type can be inferred from the initializing expression. To understand how it works, you should learn about type inference: http://msdn.microsoft.com/en-us/vstudio/jj131514.aspx[^].

—SA


这篇关于无法在visual studio intellisence中看到var数据类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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