New to C#

This is a discussion on New to C# within the C# Programming forums, part of the General Programming Boards category; Hello all, I'm starting to pick up C#. I come from a java background so a lot of things look ...

  1. #1
    Registered User
    Join Date
    Jul 2007
    Posts
    186

    New to C#

    Hello all,

    I'm starting to pick up C#. I come from a java background so a lot of things look familiar but a few things don't. I'm starting a simple Hello World program using Visual Studio. Here's what I have combined with what VS gave me:
    Code:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    
    namespace ConsoleApplication1
    {
        class Program
        {
            static void Main(string[] args)
            {
                Console.WriteLine("Hello World");
                Console.ReadLine();
            }
        }
    }
    Everything makes sense except for the namespace ConsoleApplication1 part. Do I need that? Can I just have it say "public class Program" like I would in java?

    Also, does anyone know if there's a good C# plug-in for Eclipse?

    Thanks

  2. #2
    Registered User
    Join Date
    Mar 2009
    Location
    england
    Posts
    209
    It can be as simple as this:

    Code:
    using System;
    
    class Program
    {
        static void Main()
        {
            Console.WriteLine("blah");
            Console.ReadKey();
        }
    }
    Obviously, when you start making indepth programs spanning over many classes, you'll appreciate the ability to use NameSpaces. They are a god-send for larger projects!

  3. #3
    Registered User
    Join Date
    Aug 2008
    Posts
    188
    a namespace is comparable to a package in java.

  4. #4
    Registered User
    Join Date
    Jul 2007
    Posts
    186
    Hey thanks, that's quite helpful. I found a page on C# for Java programmers which was also helpful: C# From a Java Developer's Perspective.

    Still looking for a good C# plugin for eclipse

  5. #5
    Registered User valaris's Avatar
    Join Date
    Jun 2008
    Location
    RING 0
    Posts
    507
    Why not use microsoft C#? It's free.
    Visual C# 2008 Express Edition

  6. #6
    Registered User
    Join Date
    Jul 2007
    Posts
    186
    Thanks I'll look into that. I found a good tutorial on C# that I'm going through now. It seems very similar to Java which is very helpful. I've also read that you can use C# with ASP.NET. I don't really know what ASP.NET is except that it's for web development. I don't know much about web development but I'd really like to. Maybe after I learn a bit more C# I can learn what ASP.NET is and how to use it with C#. Does anyone know any good resources for ASP.NET+C#?

  7. #7
    Registered User valaris's Avatar
    Join Date
    Jun 2008
    Location
    RING 0
    Posts
    507

Popular pages Recent additions subscribe to a feed

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