Home > Coding > New (at least for me) IO functions.

New (at least for me) IO functions.

embarrassing

Well, live and learn. This was an interesting day. I am working on a little project right now, can’t really discuss details, and quite frankly it is nothing that I am going to be too proud of once it is done. But this is not the point. I had to do some minor IO work with this and this is when I found that instead of doing stuff like:

  |  copy code |? 
01
02
 
03
_fsCFileStream = new FileStream(sFileName, FileMode.Open, System.IO.FileAccess.Read);
04
_srStreamReader = new StreamReader(_fsCfMCCSV, Encoding.GetEncoding(1252));
05
 
06
try
07
{
08
    if ((sLineIn = _srCfMCCSV.ReadLine()) == null)
09
        //do stuff here
10
}catch(){}
11

I can simply do
  |  copy code |? 
1
2
File.ReadAllLines();
3

I guess I was stuck on .Net 1.3 for so long, I completely skipped 2.x and now 3.5 is full of surprises. I know I am behind times, need to catch up soon. Gone to do some reading.

Categories: Coding Tags: , , ,
  1. No comments yet.
  1. No trackbacks yet.

Spam Protection by WP-SpamFree