Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Weird C# Error

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Cardio
Grandmaster Cheater Supreme
Reputation: 0

Joined: 29 Jun 2006
Posts: 1641
Location: New York City

PostPosted: Fri Jan 18, 2008 4:42 pm    Post subject: Weird C# Error Reply with quote

For some reason I can't even compile a simple C# Hello program. It tells me I have invalid tokens where pointed out in the quote below.

Code:

using System;
class Hello
{
    public static void Main();
{ <-------------This opening bracket
    Console.WriteLine("Hello"); <-------The first parenthesis here
}
} <-------- This closing bracket


Could it possibly be because I'm using the 2005 Visual Studio command prompt? >_<
Back to top
View user's profile Send private message AIM Address MSN Messenger
NINTENDO
Grandmaster Cheater Supreme
Reputation: 0

Joined: 02 Nov 2007
Posts: 1371

PostPosted: Fri Jan 18, 2008 5:22 pm    Post subject: Re: Weird C# Error Reply with quote

The Shadow wrote:
For some reason I can't even compile a simple C# Hello program. It tells me I have invalid tokens where pointed out in the quote below.

Code:

using System;
class Hello
{
    public static void Main();
{ <-------------This opening bracket
    Console.WriteLine("Hello"); <-------The first parenthesis here
}
} <-------- This closing bracket


Could it possibly be because I'm using the 2005 Visual Studio command prompt? >_<


In C# you dont end main with ;
It is as simple as that.
Code:
using System;
class Hello
{
     static void Main(string[] args)
{ //<-------------This opening bracket
    Console.WriteLine("Hello"); //<-------The first parenthesis here
}
} //<-------- This closing bracket

_________________
Intel over amd yes.
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger
samuri25404
Grandmaster Cheater
Reputation: 7

Joined: 04 May 2007
Posts: 955
Location: Why do you care?

PostPosted: Fri Jan 18, 2008 8:09 pm    Post subject: Reply with quote

For God's sake, man, indent your code!

Code:

using System;
class Hello
{
    public static void Main();
    { <-------------This opening bracket
         Console.WriteLine("Hello"); <-------The first parenthesis here
    }
} <-------- This closing bracket


It might not be much now, but believe me, when it gets into a much larger projects, it's gonna suck to have un-indented code.

_________________
Wiccaan wrote:

Oh jeez, watchout I'm a bias person! Locked.


Auto Assembly Tuts:
In Depth Tutorial on AA
Extended
Back to top
View user's profile Send private message
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Fri Jan 18, 2008 8:28 pm    Post subject: Reply with quote

You don't use a ; because the public static void Main() is a function.

Indenting code is one of the most important things you can do. Get a good coding style.

_________________
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
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
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites