public static MethodContractInfo TryCreate( [NotNull] IMethodDeclaration declaration, TreeTextRange selectedTreeRange, [NotNull] Func <IType, bool> isAvailableForType) { if (declaration.GetNameRange().Contains(selectedTreeRange) && declaration.ArrowClause == null) { var method = declaration.DeclaredElement; if (method != null && CanAcceptContracts(method) && !method.ReturnType.IsVoid() && isAvailableForType(method.ReturnType)) { return(new MethodContractInfo(declaration, method.ReturnType)); } } return(null); }