Streams are not restricted to files. You can access the data in memory. Streams are really flexible because they can be chained and you can deal with stream data generically.
File IO is a basic task, which every developer needs to know. In C#, Streams are used to read/write data from/to a file. Streams are generic representation of data flow. They are not restricted to files. Using streams, you can access data from many different sources (such as memory) in the same manner. Stream related classes are usually located within the “System.IO” namespace.
You can browse directories and files programmatically using the “DirectoryInfo” and “FileInfo” classes. But this is the snapshot of the specific moment. What if you want to monitor the changes of files and folders (created, updated, renamed …)
Let’s start with files and folders(directories). It is very straight-forward and easy to do basic file management tasks in .NET. Just find the pattern and think of each section of this post as a how-to manual. Most types related I/O are under the “System.IO” namespace.
Usually 2 types are provided for each file system type (file, directory, …). For example, the “Directory” class provides static methods and the “DirectoryInfo” class provides instance methods.