how to identify a file is a text file or other using c#.net

Posted by bjh Hans on Stack Overflow See other posts from Stack Overflow or by bjh Hans
Published on 2010-04-08T05:56:28Z Indexed on 2010/04/08 6:03 UTC
Read the original article Hit count: 233

Filed under:

I need to access a file as text file and want to process it later. But before I fetch it how I can identify a file that I am taking is a text file only. If file is in another format my whole code interpret wrongly. I want to access and process only text file.

Currently i am using:

StreamReader objReader = new StreamReader(filePath);

How can I do so in C# .NET?

© Stack Overflow or respective owner

Related posts about c#.net