How can I test whether a file that I\'m opening in C# using FileStream is a \"text type\" file? I would like my program to open any file that is text based, for example, .t
public bool IsTextFile(string FilePath) using (StreamReader reader = new StreamReader(FilePath)) { int Character; while ((Character = reader.Read()) != -1) { if ((Character > 0 && Character < 8) || (Character > 13 && Character < 26)) { return false; } } } return true; }