【发布时间】:2012-02-24 11:26:48
【问题描述】:
Visual Studio 是否有任何类型的快捷方式(快捷方式意味着不写出实际类型名称),允许您编写“var”并将其转换为实际类型名称?
例如:
var x = new Dictionary<string, string>();
::做魔术::
Dictionary<string, string> x = new Dictionary<string, string>();
编辑—— 对于所有讨厌问题的人:我问是因为我想在我的解决方案中找到对特定类型的所有引用。变量不会出现在该搜索中。
【问题讨论】:
-
ReSharper 可以做到这一点。不知道你是否想听:)
-
不是每个人都喜欢
var,没关系。 -
非var版本伤了我的眼睛!
-
@Bernard 因为这是一个偏好问题?
-
@Yuck,马龙:
global::System.Collections.Generic.Dictionary<global::System.String, global::System.String> x
标签: c# visual-studio types var