Introduction to file handling in C#

Realize: What is record dealing within C#.Net? What are streams, kind of streams, fundamental document activities and classes are utilized for record tasks?

What is a file in C#?

The document/file is an assortment of information, which has one of a kind name and stores information in an explicit way. At the point when we open a document for perusing or composing, it is known as a stream.

What is Stream?

The stream is an arrangement of bytes. There are two kinds of streams are utilized:

  1. Information stream
    1. This stream is utilized to peruse information from the document, which is known as a reading activity.
  2. Output stream
    1. This stream is utilized to compose information into the record, which is known as compose activity.

Namespace to use for document tasks

In C#, System.IO namespace is utilized to perform document tasks.

There are following document tasks utilized in C#:

  1. Making of record
  2. Cancellation of record
  3. Perusing information from document
  4. Composing information into document
  5. Affixing information into record
  6. Opening a document
  7. Shutting a document and so forth…

There are following classes are utilized document dealing with in C#:

  1. BinaryReader
  2. BinaryWriter
  3. BufferedStream
  4. Index
  5. DirectoryInfo
  6. DriveInfo
  7. Document
  8. FileInfo
  9. FileStream
  10. MemoryStream
  11. Way
  12. StreamReader
  13. StreamWriter
  14. StringReader
  15. StringWriter

There are following document modes utilized in C#:

  1. Open
  2. Make
  3. CreateNew
  4. OpenOrCreate
  5. Affix
  6. Shorten

Leave a Comment

error: Alert: Content is protected!!