示例#1
0
        private static DelegateDeclarationSyntax GenerateDelegateDclr(IMethodSymbol methodSymbol, string delegateName,
                                                                      INamedTypeSymbol stubbedInterface)
        {
            SyntaxKind                visibility          = RoslynUtils.GetVisibilityKeyword(stubbedInterface);
            List <ParameterSyntax>    paramsSyntaxList    = RoslynUtils.GetMethodParameterSyntaxList(methodSymbol);
            DelegateDeclarationSyntax delegateDeclaration = SF.DelegateDeclaration(SF.ParseTypeName(methodSymbol.ReturnType.GetFullyQualifiedName()),
                                                                                   delegateName)
                                                            .AddModifiers(SF.Token(visibility)).AddParameterListParameters(paramsSyntaxList.ToArray());

            delegateDeclaration = RoslynUtils.CopyGenericConstraints(methodSymbol, delegateDeclaration);
            return(delegateDeclaration);
        }