public void SetConstraint(TemplateConstraint constraint) { if (this.Constraint != null) { throw new InvalidOperationException(); } this.Constraint = constraint ?? TemplateConstraint.Create(NameReference.Create(this.Name), null, null, null, null); this.AssociatedType = TypeDefinition.CreateTypeParameter(this); this.InstanceOf = AssociatedType.GetInstance(overrideMutability: TypeMutability.None, translation: null, lifetime: Lifetime.Timeless); this.attachPostConstructor(); }