是否有用于水平字符串连接的内置函数?

Rai*_*olt 8 c#

鉴于两个文件:

文件1

aaa
bbb
ccc

文件2

dd
ee

Bash有一个命令可以横向连接这些文件:

paste File1 File2
Run Code Online (Sandbox Code Playgroud)

aaadd
bbbee
ccc

C#有一个内置函数,表现如下吗?

pok*_*oke 1

public void ConcatStreams(TextReader left, TextReader right, TextWriter output, string separator = " ")
{
    while (true)
    {
        string leftLine = left.ReadLine();
        string rightLine = right.ReadLine();
        if (leftLine == null && rightLine == null)
            return;

        output.Write((leftLine ?? ""));
        output.Write(separator);
        output.WriteLine((rightLine ?? ""));
    }
}
Run Code Online (Sandbox Code Playgroud)

使用示例:

StringReader a = new StringReader(@"a a a
b b b
c c c";
StringReader b = new StringReader(@"d d
e e";

StringWriter c = new StringWriter();
ConcatStreams(a, b, c);
Console.WriteLine(c.ToString());
// a a a d d
// b b b e e
// c c c 
Run Code Online (Sandbox Code Playgroud)