Linux Format forums Forum Index Linux Format forums
Help, discussion, magazine feedback and more
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Help, I'm stuck on Project One!

 
Post new topic   Reply to topic    Linux Format forums Forum Index -> Programming
View previous topic :: View next topic  
Author Message
compo



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

PostPosted: Sat Jan 16, 2010 8:50 pm    Post subject: Help, I'm stuck on Project One! Reply with quote

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
Back to top
View user's profile Send private message
Ram
LXF regular


Joined: Thu Apr 07, 2005 10:44 pm
Posts: 1668
Location: Guisborough

PostPosted: Sat Jan 16, 2010 9:16 pm    Post subject: Reply with quote

No semicolon after using System.IO

Your code should look like this:


Code:


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.....
Back to top
View user's profile Send private message MSN Messenger
compo



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

PostPosted: Sat Jan 16, 2010 9:25 pm    Post subject: Doh! Reply with quote

Thanks Ram.
Back to top
View user's profile Send private message
View previous topic :: View next topic  
Display posts from previous:   
Post new topic   Reply to topic    Linux Format forums Forum Index -> Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Linux Format forums topic RSS feed 


Powered by phpBB © 2001, 2005 phpBB Group


Copyright 2011 Future Publishing, all rights reserved.


Web hosting by UKFast