问题描述
流是种神秘的给我。我不知道什么时候要使用的流,以及如何使用它们。能向我解释某人流是如何使用的?如果我理解正确的有三种流类型:流,读取流和写入流。它是否正确?什么是例如一个MemoryStream和FileStream区别?
Streams are kind of mysterious to me. I don't know when to use which stream and how to use them. Can someone explain to me how streams are used? If I understand correctly there are three stream types: stream, read stream and write stream. Is this correct? And what is for example the difference between a Memorystream and a FileStream?
推荐答案
甲流是一种用于传输data.Very对象常,外部源将一个文件,在这种情况下,将使用的FileStream,但不一定是如此。例如MemoryStream的用于将数据存储在存储器中和System.Net.Sockets.NetworkStream处理网络data.There是一个通用的流类,的System.IO.Stream,从其中所有流的。读写器流如的StreamReader和StreamWriter是不是由他们寡情流,他们不是从的System.IO.Stream派生,他们的目的是帮助编写和读取数据和流!
A stream is an object used to transfer data.Very often, the outside source will be a file , in this case you will use FileStream, but that is not necessarily the case. For example MemoryStream is used to store data in memory and System.Net.Sockets.NetworkStream handles network data.There is a generic stream class,System.IO.Stream, from which all streams are derived. Reader writer streams such as StreamReader and StreamWriter are not streams by their meaner, they are not derived from System.IO.Stream, they are designed to help to write and read data from and to stream!
这篇关于使用流C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!