Hi,
I'm currently making the transition from VB to C# and seem to by having some trouble with the syntax.
Here's the code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace TextReaderConsole1
{
class Program
{
static void Main(string[] args)
{
TextReader reader = new StreamReader("c:\textdocs\text.txt");
string line;
while ((line = reader.ReadLine()) != null)
{
Console.WriteLine(line);
}
reader.Close();
}
}
}
It keeps giving me an "Illegal characters" message. But I don't see any illegal characters. I've tried changing everything to lowercase, including the folder and file it's referencing. The compiler is still complaining.
Any help would be appreciated.
Jeff
Loading
Kirtan PatelPosted May 17, 2009, 9:02 PM
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace TextReaderConsole1
{
class Program
{
static void Main(string[] args)
{
TextReader reader = new StreamReader(@"c:\textdocs\text.txt");
string line;
while ((line = reader.ReadLine()) != null)
{
Console.WriteLine(line);
}
reader.Close();
}
}
}