CodeTypeParameter.HasConstructorConstraint 属性

定义

获取或设置一个值,该值指示类型参数是否具有构造函数约束。

public:
 property bool HasConstructorConstraint { bool get(); void set(bool value); };
public bool HasConstructorConstraint { get; set; }
member this.HasConstructorConstraint : bool with get, set
Public Property HasConstructorConstraint As Boolean

属性值

Boolean

如果类型参数具有构造函数约束,则为 true;否则为 false。 默认值为 false

示例

下面的代码示例演示了 HasConstructorConstraint 用于确定类型参数是否具有构造函数约束的属性。 此示例是为类提供的大型示例的 CodeTypeParameter 一部分。

kType.HasConstructorConstraint = true;
kType.HasConstructorConstraint = True

注解

构造函数约束向编译器指示类型参数公开默认公共构造函数, (没有参数的公共构造函数) 。

适用于