【发布时间】:2016-01-15 13:59:43
【问题描述】:
一位同事刚刚给了我一些必须在 .NET 应用程序中使用的 C# 类。
有个没见过的错别字,网上也找不到解释...
代码如下:
public void GoTo<TView>() where TView : Form, new()
{
var view = Activator.CreateInstance<TView>();
//si on vient de creer une startup view alors on affiche l'ancienne
//la reference a la nouvelle sera detruite en sortant de la fonction GoTo
if (view is StartupForm)
{
ShowView(_StartupForm);
}
else ShowView(view);
}
方法声明末尾的new() 关键字是什么?
【问题讨论】:
标签: c# syntax new-operator keyword method-declaration