• home
  • Email: trainings@synapseindia.careers

Blogs

back

Reading and writing File is very easy in C# as compared to other languages like C,C++ and Java

Mar 14, 2015

One very common task in any programming language is the ability to write information to a file and read it back in. This is often called "file input and output", or simply "file I/O". File I/O is quite typical and hard due to a lot of conversions while reading and writing . When you're doing file I/O, you will likely need to take your data and turn it into a format that works for one of the output methods, and then parse the text coming back in, so that you can reconstruct your objects. In other words, there's more to the typical file writing process than just dumping stuff into a file—you'll also need to get your data into the right format. Due to all such issues .Net Framework provides user friendly libraries by which we can very easily handle file level operations. Instead of writing a text-based file, the other choice is to write a binary file. When you write a binary file, you won't be able to open up the file in a text editor. It will just be a pile of bytes, and it will look like gibberish. But binary files have a couple of advantages. First, binary files usually take up less space than text-based files. Second, the data is "encrypted" to some extent. Since it isn't text-based, people can't just open it up and read it, so it sort of protects your data. File I/O is a very powerful and important thing to be able to do very easily by using C# with the help of .Net Framework libraries.

SynapseIndia (CEO: Shamit Khemka)

Leave a Reply

Your email address will not be published.