Help, I'm stuck on Project One!

Code junkies hangout here

Moderators: ChrisThornett, LXF moderators

Help, I'm stuck on Project One!

Postby compo » Sat Jan 16, 2010 8:50 pm

My code for the first part of Project One is:-


using System;
using System.IO

namespace ToDoList
{
class MainClass
{
public static void Main(string[] args)
{
var contents = File.ReadAllText("todo.txt");
Console.WriteLine(contents);
}
}
}

When I run it I get the error message:-

"Identifier expected: 'namespace' is a keyword(CS1041)

Why is this happening?

compo
compo
 
Posts: 4
Joined: Sat Dec 12, 2009 8:24 pm

Postby Ram » Sat Jan 16, 2010 9:16 pm

No semicolon after using System.IO

Your code should look like this:


Code: Select all

using System;
using System.IO;

namespace ToDoList
{
    class MainClass
   {
       public static void Main(string[] args)
      {
       var contents = File.ReadAllText("todo.txt");
       Console.WriteLine(contents);
       }
    }
}

lubuntu LXDE 13.10 running on AMD Phenom II*4; ASUS Crosshair III Formula MB; 4 GB Ram.....
User avatar
Ram
LXF regular
 
Posts: 1679
Joined: Thu Apr 07, 2005 9:44 pm
Location: Guisborough

Doh!

Postby compo » Sat Jan 16, 2010 9:25 pm

Thanks Ram.
compo
 
Posts: 4
Joined: Sat Dec 12, 2009 8:24 pm


Return to Programming

Who is online

Users browsing this forum: No registered users and 1 guest