public static TypeArgumentSpecification Named(this TypeArgumentSpecification @this, string name) { Guard.NotNull(@this, "this"); Guard.NotNullOrWhiteSpace(name, "name"); return(@this.Combine(x => Outcome.FailIf(x.Name != name, String.Format("Not named '{0}'.", name)))); }
public static TypeArgumentSpecification Type(this TypeArgumentSpecification @this, Func <Type, TypeSpecification, TypeSpecification> typeSpecification) { Guard.NotNull(@this, "this"); Guard.NotNull(typeSpecification, "typeSpecification"); return(@this.Combine(ta => typeSpecification(ta, TypeSpecificationBuilder.Any)(ta))); }
public static TypeArgumentSpecification MustBeReferenceType(this TypeArgumentSpecification @this) { Guard.NotNull(@this, "this"); return(@this.Combine(ta => Outcome.FailIf(!ta.GenericParameterAttributes.Contains(GenericParameterAttributes.ReferenceTypeConstraint), "Cannot be reference type."))); }
public static TypeArgumentSpecification AtIndex(this TypeArgumentSpecification @this, int index) { Guard.NotNull(@this, "this"); return(@this.Combine(x => Outcome.FailIf(x.GenericParameterPosition != index, "Not at correct index."))); }