Java InputStream和OutputStream是否有C#等效方法? [英] Is there a C# equivalent way for Java InputStream and OutputStream?

查看:649
本文介绍了Java InputStream和OutputStream是否有C#等效方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我指的是用java编写的源代码,它包含 InputStream OutputStream 对象,我想知道C#中是否有一种创建用户预定义的方法InputStream和Outpustream类;如果不是java InputStream和OutputStream对象,如果我将它们视为一个简单的Stream对象,它们将具有相同的功能吗?

I am referring to the source code written in java and it contains InputStream and OutputStream objects throughout, i wonder if there is a way in C# to create user-predifined InputStream and Outpustream Classes ; if not the java InputStream and OutputStream objects will they have the same functionality if i treat them as a simple Stream object?

推荐答案

.NET中的输入流和输出流之间没有类型级别的区别。只需从 System.IO.Stream 派生自定义类,然后让重写的属性 CanRead CanWrite 返回适当的值。

There is no type-level distinction between in- and out-streams in .NET. Just derive your custom class from System.IO.Stream and let the overridden properties CanRead and CanWrite return the appropriate values.

这篇关于Java InputStream和OutputStream是否有C#等效方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆