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