public IEnumerable <SyntaxNode> GetNodes(SyntaxGenerator gen) { var type = SyntaxFactory.ParseTypeName(Type); var parms = gen.GetParamNodes(this).OfType <ParameterSyntax>(); var indx = SyntaxFactory.IndexerDeclaration(type) .WithModifiers(Visibility.ToKeyword().ToList()) .AddParameterListParameters(parms.ToArray()); var isAuto = Getter == null && Setter == null; if (isAuto || Getter != null) { var get = SyntaxFactory.AccessorDeclaration(SyntaxKind.GetAccessorDeclaration); if (isAuto || Getter == null) { get = get.WithSemicolonToken(SyntaxFactory.Token(SyntaxKind.SemicolonToken)); } else { get = get.WithBody(SyntaxExts.GetBlockFromCode(Getter)); } indx = indx.AddAccessorListAccessors(get); } if (isAuto || Setter != null) { var set = SyntaxFactory.AccessorDeclaration(SyntaxKind.SetAccessorDeclaration); if (isAuto || Setter == null) { set = set.WithSemicolonToken(SyntaxFactory.Token(SyntaxKind.SemicolonToken)); } else { set = set.WithBody(SyntaxExts.GetBlockFromCode(Setter)); } indx = indx.AddAccessorListAccessors(set); } yield return(indx); }