示例#1
0
        public IEnumerable <StatementSyntax> GetInitialization()
        {
            var bufferType = SF.ArrayType(SH.PredefinedType(SyntaxKind.ByteKeyword),
                                          SF.SingletonList(SF.ArrayRankSpecifier(SF.SingletonSeparatedList((ExpressionSyntax)SH.Literal(BufferSize)))));

            yield return(SH.LocalDeclaration(SF.IdentifierName("var"), outputBuffer,
                                             SF.ArrayCreationExpression(bufferType)));

            yield return(SH.LocalDeclaration(SH.PredefinedType(SyntaxKind.IntKeyword), outputIndex, SH.Literal(0)));
        }
示例#2
0
        public IEnumerable <StatementSyntax> GetInitialization()
        {
            yield return(SH.LocalDeclaration(SF.IdentifierName("var"), output,
                                             SF.ObjectCreationExpression(_stringBuilder.CreateSyntax())
                                             .WithArgumentList(SF.ArgumentList(SF.SeparatedList <ArgumentSyntax>()))));

            var bufferType = SF.ArrayType(SH.PredefinedType(SyntaxKind.CharKeyword),
                                          SF.SingletonList(SF.ArrayRankSpecifier(SF.SingletonSeparatedList((ExpressionSyntax)SH.Literal(BufferSize)))));

            yield return(SH.LocalDeclaration(SF.IdentifierName("var"), outputBuffer,
                                             SF.ArrayCreationExpression(bufferType)));

            yield return(SH.LocalDeclaration(SH.PredefinedType(SyntaxKind.IntKeyword), outputIndex, SH.Literal(0)));
        }