I am using this piece of code to read from file but have an error “Cannot create an instance of abstract class or interface “System.IO.TextReader””
using (FileStream fileStream = File.Open(fileName, FileMode.Open, FileAccess.Read))
using(TextReader reader = new TextReader(fileStream))//error
{
...
}
You cannot instantiate TextReader object directly, its an abstract class. Try using StreamReader or StringReader instead.
See details/usage of StreamReader on MSDN