[英]Java's PipedReader / PipedWriter equivalents in C#?
I have defined a Pipe class in Java, making use of PipedReader
and PipedWriter
. 我已经使用
PipedReader
和PipedWriter
在Java中定义了Pipe类。 I am now trying to port this same class to C#. 我现在正尝试将同一类移植到C#。 Is it possible to accomplish the same as shown in the following code in C#?
是否可以完成以下C#中的代码所示的操作?
public final class Pipe {
private final PipedReader pipedReader = new PipedReader();
private final PipedWriter pipedWriter = new PipedWriter();
public Pipe() {
pipedWriter.connect(pipedReader);
}
...
}
I am guessing what I'll want to use in C# for PipedReader
and PipedWriter
will be StreamReader
and StreamWriter
? 我猜我要在C#中为
PipedReader
和PipedWriter
是StreamReader
和StreamWriter
?
Is there something like a connect()
method? 是否有类似
connect()
方法?
So, my goal is to implement a (little) Pipe&Filter framework. 因此,我的目标是实现一个(很小的)Pipe&Filter框架。 My idea would be to create a Pipe class and Filter classes, so that when I need to implement some system using a Pipe&Filter architecture style, I'll code it against this little framework I am using.
我的想法是创建一个Pipe类和Filter类,以便当我需要使用Pipe&Filter体系结构样式实现某些系统时,我将根据我使用的这个小框架对其进行编码。 Each filter would run on its own thread.
每个过滤器将在其自己的线程上运行。
Thanks 谢谢
I'm not sure if this is exactly what you are looking for, but there is a tutorial on using .Net pipes here . 我不知道如果这是你在寻找什么,但有一个教程使用的.Net管这里 。 This will only work with .Net 3.5+.
仅适用于.Net 3.5+。
EDIT: 编辑:
There are examples on MSDN about using anonymous pipes. MSDN上有一些有关使用匿名管道的示例。 See this link .
请参阅此链接 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.