Naming rules for classes conatining program entry points

This is a discussion on Naming rules for classes conatining program entry points within the C# Programming forums, part of the General Programming Boards category; I remember reading something in a Java manual about how the class that contained the main entry point of the ...

  1. #1
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913

    Naming rules for classes conatining program entry points

    I remember reading something in a Java manual about how the class that contained the main entry point of the program needed to have the same name as the file name. Is there such a rule or a similar one in C#? Can I put my main method inside a class regardless of that classes name or the filename?

  2. #2
    Registered User Frobozz's Avatar
    Join Date
    Dec 2002
    Posts
    546
    Simplest way to find out is to test. I just tested and the filename and classname can be different.

  3. #3
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,139
    You can have only one main method, but you can put it into any class you like.
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Simple Blackjack Program
    By saber1357 in forum C Programming
    Replies: 1
    Last Post: 03-28-2009, 04:19 PM
  2. Replies: 8
    Last Post: 11-03-2008, 09:48 PM
  3. managing iptables rules from C program
    By fadey in forum Linux Programming
    Replies: 1
    Last Post: 02-11-2008, 09:34 AM
  4. Contest - Traveller's Dilemma
    By pianorain in forum Contests Board
    Replies: 49
    Last Post: 07-03-2007, 09:39 AM
  5. Contest Results - May 27, 2002
    By ygfperson in forum A Brief History of Cprogramming.com
    Replies: 18
    Last Post: 06-18-2002, 02:27 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21