/// <summary>
 /// Checks whether the method is a generic method.
 /// </summary>
 /// <param name="methodAttribute">The <see cref="MethodAttribute{TAttribute}"/> instance to check.</param>
 /// <returns>True if the method satisfies the constraint, false otherwise.</returns>
 public bool SatisfiesConstraint(MethodAttribute <TAttribute> methodAttribute)
 => methodAttribute.Method.IsGenericMethod;
 /// <summary>
 /// Checks whether the method can be called using a parameter pack.
 /// </summary>
 /// <param name="methodAttribute">The <see cref="MethodAttribute{TAttribute}"/> instance to check.</param>
 /// /// <param name="parameterPack">The <see cref="IParameterPack"/> pack.</param>
 /// <returns>True if the method satisfies the constraint, false otherwise.</returns>
 public bool SatisfiesConstraint(MethodAttribute <TAttribute> methodAttribute, TParameterPack parameterPack)
 => parameterPack.CompatibleWith(methodAttribute.Method);
 /// <summary>
 /// Checks whether the method is an instance method.
 /// </summary>
 /// <param name="methodAttribute">The <see cref="MethodAttribute{TAttribute}"/> instance to check.</param>
 /// <returns>True if the method satisfies the constraint, false otherwise.</returns>
 public bool SatisfiesConstraint(MethodAttribute <TAttribute> methodAttribute)
 => !methodAttribute.Method.IsStatic;
 /// <summary>
 /// Checks whether the method matches a signature.
 /// </summary>
 /// <param name="methodAttribute">The <see cref="MethodAttribute{TAttribute}"/> instance to check.</param>
 /// <param name="signature">The <see cref="IMethodSignature"/> signature.</param>
 /// <returns>True if the method satisfies the constraint, false otherwise.</returns>
 public bool SatisfiesConstraint(MethodAttribute <TAttribute> methodAttribute, TSignature signature)
 => signature.MatchesExactly(methodAttribute.Method);
 /// <summary>
 /// Checks whether the method is an abstract method.
 /// </summary>
 /// <param name="methodAttribute">The <see cref="MethodAttribute{TAttribute}"/> instance to check.</param>
 /// <returns>True if the method satisfies the constraint, false otherwise.</returns>
 public bool SatisfiesConstraint(MethodAttribute <TAttribute> methodAttribute)
 => methodAttribute.Method.IsAbstract;
示例#6
0
 public static string ParameterPackValidationMessage <TAttribute, TParameterPack>(MethodAttribute <TAttribute> attribute, TParameterPack parameters, string prefix)
     where TAttribute : Attribute
     where TParameterPack : IParameterPack
 => GetMethodPropertyValidationString(prefix, attribute.Type.FullName, attribute.Method.Name, $"be callable using `{parameters.GetPackName()}` parameters");
示例#7
0
 public static string SignatureValidationMessage <TAttribute>(MethodAttribute <TAttribute> attribute, IMethodSignature signature, string prefix)
     where TAttribute : Attribute
 => GetMethodPropertyValidationString(prefix, attribute.Type.FullName, attribute.Method.Name, $"match `{signature.GetSignatureName()}` signature");
示例#8
0
 public static string GenericValidationMessage <TAttribute>(MethodAttribute <TAttribute> attribute, string prefix)
     where TAttribute : Attribute
 => GetMethodPropertyValidationString(prefix, attribute.Type.FullName, attribute.Method.Name, $"{(attribute.Method.IsStatic ? "not " : "")}be generic");