コード例 #1
0
        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))));
        }
コード例 #2
0
        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)));
        }
コード例 #3
0
 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.")));
 }
コード例 #4
0
 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.")));
 }