什么是新的()是什么意思? [英] What does new() mean?

查看:146
本文介绍了什么是新的()是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有在WCF RIA服务的 AuthenticationBase 类。类定义如下:

There is an AuthenticationBase class in WCF RIA Services. The class definition is as follows:

// assume using System.ServiceModel.DomainServices.Server.ApplicationServices

public abstract class AuthenticationBase<T> 
    : DomainService, IAuthentication<T> 
    where T : IUser, new()

这是什么新()在这个code是什么意思?

What does new() mean in this code?

推荐答案

这是新的约束

它指定了 T 绝不能的抽象并必须公开公共构造的以用作泛型类型参数中的 AuthenticationBase&LT; T&GT; 类。

It specifies that T must not be abstract and must expose a public parameterless constructor in order to be used as a generic type argument for the AuthenticationBase<T> class.

这篇关于什么是新的()是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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