| C# for beginners :) | |
|
|
Author | Message |
---|
triclops200
Posts : 6 Join date : 2010-08-16
| Subject: 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 . - 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 - 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 . | |
|
| |
Excimer Sun Software
Posts : 152 Join date : 2010-05-07 Age : 31 Location : USA
| Subject: 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. | |
|
| |
triclops200
Posts : 6 Join date : 2010-08-16
| Subject: Re: C# for beginners :) Sat Aug 21, 2010 3:23 am | |
| thank you , and I dislike Java . but I will post a step 2 tutorial tomorrow. | |
|
| |
Excimer Sun Software
Posts : 152 Join date : 2010-05-07 Age : 31 Location : USA
| Subject: Re: C# for beginners :) Sat Aug 21, 2010 7:27 pm | |
| Yeah, I don't like Java either. 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. | |
|
| |
Compu-Teck Inc.
Posts : 80 Join date : 2010-04-29 Age : 31
| Subject: 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 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 ) | |
|
| |
triclops200
Posts : 6 Join date : 2010-08-16
| Subject: 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. | |
|
| |
Excimer Sun Software
Posts : 152 Join date : 2010-05-07 Age : 31 Location : USA
| Subject: 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 , so I can definitely relate! | |
|
| |
triclops200
Posts : 6 Join date : 2010-08-16
| Subject: 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. | |
|
| |
Compu-Teck Inc.
Posts : 80 Join date : 2010-04-29 Age : 31
| Subject: 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! kidding! seriously, good job here, triclops. | |
|
| |
Sponsored content
| Subject: Re: C# for beginners :) | |
| |
|
| |
| C# for beginners :) | |
|