C#语法-变量名后的冒号 [英] C# syntax - Colon after a variable name

查看:387
本文介绍了C#语法-变量名后的冒号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

快速提问;我最近升级到VS2010,并获得了新版本的ReSharper。

Quick question; I've recently upgraded to VS2010, and got the new version of ReSharper.

现在,当ReSharper为我提供变量的自动填充选项时,它为我提供了< variableName >:

Now, when ReSharper is giving me autocomplete options for a variable, it give me the option of <variableName>:

代表什么?

例如;我有这个:

var productIds = new List<int>(inventoryItemsToProcess.Keys);

当我开始输入这样的一行时:

And when I start typing out a line like this:

var lastOrderDates = GetProductLastOrderDates(pro

It为我提供了 productIds 以及 productIds:

It gives me the option for productIds as well as productIds:

两者之间有什么区别?

推荐答案

第二个用于C#4.0 命名参数。这是MSDN上的链接

The second is for C# 4.0 named arguments. And here's a link on MSDN.

这篇关于C#语法-变量名后的冒号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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