HomePortalFAQSearchMemberlistUsergroupsRegisterLog in

Share | 
 

 C# for beginners :)

Go down 
AuthorMessage
triclops200



Posts : 6
Join date : 2010-08-16

PostSubject: C# for beginners :)   Mon Aug 16, 2010 4:05 pm

C# is a very easy to use OOP (Object Oriented Programing) language. It is very powerful and very fast, despite it being tied to .net. lets just do the simple hello world for now and I'll post more complex tutorials later Smile.

Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace helloworld
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            Console.ReadKey();
        }
    }
}

okay let's break it down Smile
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
this is the place where you define what the code will use to run. if you were to need to use network stuff you would add:
Code:
using System.Net;
now for the next bit.
Code:

namespace helloworld
{
    class Program
    {
your namespace is where you define your classes that your program will use, namespaces of the same name can be spread over multiple files and the classes under the same namespace will be accesable inside of the whole namespace. classes are containers of variables and functions which are used for your code.
Code:
 static void Main(string[] args)
        {
This is where the program starts(Always in the Main() function), it is also a function definition. A function is a system of commands that can be called at any point within the same class. (or outside of the class, but that is a little harder and for a future lesson).
Code:
Console.WriteLine("Hello World!");
            Console.ReadKey();
Console.Writeline() is used to write an output to the console and then add a new line after that. Console.ReadKey() is just used here to pause the program so you can see the output.
your done, compile and see the results Smile.
Back to top Go down
View user profile
Excimer Sun Software

avatar

Posts : 152
Join date : 2010-05-07
Age : 26
Location : USA

PostSubject: Re: C# for beginners :)   Wed Aug 18, 2010 6:45 pm

Thank you for this, triclops! This is the kind of knowledge and ability I was hoping to attract to CC when I posted on the PT forum! Interestingly, minus the namespace declaration, this looks frighteningly similar to Java. Shocked
Back to top Go down
View user profile
triclops200



Posts : 6
Join date : 2010-08-16

PostSubject: Re: C# for beginners :)   Sat Aug 21, 2010 3:23 am

thank you Smile, and I dislike Java Razz. but I will post a step 2 tutorial tomorrow.
Back to top Go down
View user profile
Excimer Sun Software

avatar

Posts : 152
Join date : 2010-05-07
Age : 26
Location : USA

PostSubject: Re: C# for beginners :)   Sat Aug 21, 2010 7:27 pm

Yeah, I don't like Java either. Razz Unfortunately, the language on the AP test, for my computer programming AP course, is Java, so I have to work with it. I normally work with, and prefer, Python.Smile
Back to top Go down
View user profile
Compu-Teck Inc.



Posts : 80
Join date : 2010-04-29
Age : 25

PostSubject: Re: C# for beginners :)   Tue Aug 24, 2010 1:40 pm

I also prefer Python. It is actually the language I am working with. I have just started OOP in Python Very Happy
If anyone wants to learn Python, check out my tutorials in the Python section (located above this in the For Beginners).

(P.S. I do not know anyone that likes Java Razz )
Back to top Go down
View user profile
triclops200



Posts : 6
Join date : 2010-08-16

PostSubject: Re: C# for beginners :)   Tue Aug 24, 2010 1:44 pm

Sorry, I've been busy lately, I will post a tut ASAP, but right now I have a lot on my plate.
Back to top Go down
View user profile
Excimer Sun Software

avatar

Posts : 152
Join date : 2010-05-07
Age : 26
Location : USA

PostSubject: Re: C# for beginners :)   Tue Aug 24, 2010 10:11 pm

Just get to it when you're able, triclops. I understand having a lot on one's plate. Personally, my class load is nuts this year Shocked, so I can definitely relate!Smile
Back to top Go down
View user profile
triclops200



Posts : 6
Join date : 2010-08-16

PostSubject: Re: C# for beginners :)   Wed Aug 25, 2010 4:35 am

lol, two-a-day football training eats up my time, then school next week. maybe this weekend.
Back to top Go down
View user profile
Compu-Teck Inc.



Posts : 80
Join date : 2010-04-29
Age : 25

PostSubject: Re: C# for beginners :)   Thu Aug 26, 2010 1:38 pm

Well, maybe I can finally learn some C# from someone who actually knows what they are talking about! Laughing kidding! seriously, good job here, triclops.
Back to top Go down
View user profile
Sponsored content




PostSubject: Re: C# for beginners :)   

Back to top Go down
 
C# for beginners :)
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
Compile Crazy :: Programming :: C Family :: C# :: For Beginners-
Jump to: