Thread: void main????

  1. #1

    void main????

    Hi,

    I just downloaded the SharpDevelop (from Ken's link in the sticky post with all the links)
    I created my first hello applicatoin. Well, the wizard did, I didn't do anything. And I noticed that it says void Main.
    Is this normal with C#?
    My guess is not because the OS still will expect an integer as return value.
    So is the wizard wrong or am I ?
    Code:
    using System;
    
    class MainClass
    {
    	public static void Main(string[] args)
    	{
    		string test;
    		Console.WriteLine("Hello World!");
    		test=Console.ReadLine();
    		Console.WriteLine(test);
    	}
    }
    Also, what book do you recomend? nvoigt posted some great links (thanks nv ), but what about books? I'm not that good with learning from tutorials, I need a books to learn something


    thanks

    --Maes
    Last edited by maes; 10-01-2003 at 05:24 AM.

  2. #2
    Registered User Dante Shamest's Avatar
    Join Date
    Apr 2003
    Posts
    970
    Your program is fine. C# uses public static void Main. Microsoft 'borrowed' it from Java.

  3. #3
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,130
    Yes, your IDE is right about that... public static void /*puke*/ main

    What books will be helpful highly depends on what you want to do. Petzold has a book out that's called "Programming Microsoft Windows with C#". Pretty nice if you want to do GUI stuff, but not the type of bible the C/C++ book used to be. "Inside C#" from Microsoft press is good if you already know C++ or Java and just need to know how to transfer your knowledge to another syntax and it's quirks. "C# Essentials" from O'Reilly is a cheap but ok book to look things up if you already have a keyword to look for.
    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.

  4. #4

    Thumbs up

    thx for the advice guys

  5. #5
    I just ordered the Petzold book.
    the bookstore made an error instead of pricing it at 75€ (price of the translated dutch book) they've put 20€ on it . I think by law they have to sell it at the price they advertise it.
    I think I made a good deal here .
    I don't have it yet, I just ordered it, I hope they'll keep their part of the deal.


    Lucky me.


    Anyway, this conlcudes my funny story for today

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 03-05-2009, 10:25 AM
  2. can someone help me with these errors please code included
    By geekrockergal in forum C Programming
    Replies: 7
    Last Post: 02-10-2009, 02:20 PM
  3. Compiling sample DarkGDK Program
    By Phyxashun in forum Game Programming
    Replies: 6
    Last Post: 01-27-2009, 03:07 AM
  4. need help with handelling multiple source files
    By DarkMortar in forum C++ Programming
    Replies: 38
    Last Post: 05-26-2006, 10:46 PM
  5. getting a headache
    By sreetvert83 in forum C++ Programming
    Replies: 41
    Last Post: 09-30-2005, 05:20 AM