Library tutorials & articles

Program Entry point in C#

Example 3 & 4

kamran.cs
class zzz
{
  public static void Main(int i)
  {
  }
}


Compiler Warning
kamran.cs(3,21): warning CS0028: 'zzz.Main(int)' has the wrong signature to be an entry point

Compiler Error
error CS5001: Program 'kamran.exe' does not have an entry point defined

Here, the compiler first displays a warning that Main has not been created with the right parameters. The error, following the warning, proclaims that we have forgotten to create a function called Main. The signature includes the return type only in special cases as entry point.

kamran.cs
class zzz
{
  public static long Main()
  {
    return 0;
  }
}

Compiler Warning
kamran.cs(3,20): warning CS0028: 'zzz.Main()' has the wrong signature to be an entry point

Compiler Error
error CS5001: Program 'kamran.exe' does not have an entry point defined

The signature refers to the parameters given to the function plus the return value. Main in the above program returns 'long', hence we see the error.

Comments

  1. 06 Jan 2003 at 15:03

    I am not discouraging you, but I just dont see a need for an article on this issue.  One can find out those errors on trial and error basis with a test program.   Give us something new and creative!

  2. 01 Jan 1999 at 00:00

    This thread is for discussions of Program Entry point in C# .

Leave a comment

Sign in or Join us (it's free).

AddThis

Related discussion

Related podcasts

  • Looking into the C# Crystal Ball with Charlie Calvert and Bill Wagner

    One of the most exciting announcements from PDC was the news about C# 4.0 and Visual Studio 2010. With all the excitement and discussion throughout the event about these new developer tools, we reached out to two experts in the fields. Charlie Calvert and Bill Wagner sat down with Keith and Woody...

Events coming up

  • Dec 6

    Developing AJAX Web Applications with Castle Monorail

    London, United Kingdom

    Monorail is the model-view-controller engine of the Castle Project, bringing many of the best ideas of Ruby on Rails to the .NET world. In this talk, David De Florinier and Gojko Adzic show how Monorail makes it easy to develop .NET based AJAX applications, and how to use the Castle Project to build Web 2.0 applications effectively. Come to this session if you are a .NET web developer. Everyone is welcome!