在c#中使用新关键字下的省略号?

时间:2017-03-28 14:04:03

标签: c#

Why is there ellipses underneath the new keyword?

为什么new关键字下面有省略号。无法在互联网上找到任何文章。有多个实例我在同一个方法中使用了new关键字。除了这一个,所有看起来都正常

编辑 - 我正在使用Visual Studio 2017社区版。为UWP开发。代码运行正常,不会显示为错误。按ctrl +。什么也没有。

1 个答案:

答案 0 :(得分:3)

我猜它告诉你可以使用object initializer。所以,如果您有像

这样的代码
FolderPicker pickFolder = new FolderPicker();
folderPicker.SuggestedStartLocation = PickerLocationId.Desktop;
folderPicker.CommitButtonText = "Take it!";

Visual Studio建议使用此

FolderPicker pickFolder = new FolderPicker
{
    SuggestedStartLocation = PickerLocationId.Desktop,
    CommitButtonText = "Take it!"
};

代替。