Original Post
I got the book Teach Yourself the C# Language in 21 Days, and I just completed day 1. I did a little practice code at the end of the chapter, and I''m pretty sure that I got everthing right. But I keep getting this error "the type or namespace ''e'' could not be found (are you missing a using directive or assembly reference? CS0246) I figure that the "using" deal is it''s missing something from the top of the source, but I typed it in exactly as it was in the book. I checked the book''s website, but there was no info on this. I''ve included the code if anyone wants to have a look at it. Thanks.
using System;
using System.IO;
///
/// Class to a number listing. Assumes fewer than 1000 lines.
///
class NumberIT
{
///
/// The main entry point for the application
///
public static void Main(string[] args)
{
// check to see if a file name was included on the
// command line
if (args.Length <= 0)
{
Console.WriteLine("\nYou need to include a filename.");
}
else
{
// declare objects for connecting files...
StreamReader InFile = null;
StreamWriter OutFile = null;
try
{
// Open file name included on command line...
InFile = File.OpenText(args[0]);
// Create the output file...
OutFile = File.CreateText("outfile.txt");
Console.Write("\nNumbering...");
// Read first line of the file...
string line = InFile.ReadLine();
int ctr = 1;
// loop through the file as long as not at the end...
while (line != null)
{
OutFile.WriteLine("{0}: {1}",
ctr.ToString().PadLeft(3, ''0''), line);
Console.Write("..{0}..", ctr.ToString());
ctr++;
line = InFile.ReadLine();
}
}
catch (System.IO.FileNotFoundException)
{
Console.WriteLine("Error: {0}", e.Message);
}
finally
{
if(InFile != null)
{
// Close the files
InFile.Close();
OutFile.Close();
Console.WriteLine("...Done.");
}
}
}
}
}