Пример #1
0
        private BasePropertyDeclarationSyntax CreatePropertyDclr(IMethodSymbol methodSymbol, string propType)
        {
            if (methodSymbol.IsIndexerAccessor())
            {
                IndexerDeclarationSyntax indexerDclr = SF.IndexerDeclaration(
                    SF.ParseTypeName(propType))
                                                       .WithExplicitInterfaceSpecifier(SF.ExplicitInterfaceSpecifier(
                                                                                           SF.IdentifierName(methodSymbol.GetContainingInterfaceGenericQualifiedName())));
                indexerDclr = indexerDclr.AddParameterListParameters(
                    RoslynUtils.GetMethodParameterSyntaxList(methodSymbol).ToArray());
                return(indexerDclr);
            }

            string propName = methodSymbol.AssociatedSymbol.Name;
            PropertyDeclarationSyntax propDclr = SF.PropertyDeclaration(SF.ParseTypeName(propType), SF.Identifier(propName))
                                                 .WithExplicitInterfaceSpecifier(SF.ExplicitInterfaceSpecifier(
                                                                                     SF.IdentifierName(methodSymbol.GetContainingInterfaceGenericQualifiedName())));

            return(propDclr);
        }