• Starting C# - Any tips?
    28 replies, posted
Hey guys, I'm going to start learning C#. Anything handy I should know? :)
What do you want to develop? :) There are small differences..
First of all I'd just like to learn the code, in the future I'm going to program for games :)
Start with making simple Console applications, like a Tic-Tac-Toe or a simple text editor, something that is about your current lesson. Or just google easy tutorials you would like to do.
Here's a quick preview of what I've already coded To cut it short, it asks for a bunch of information, saves it and use it later on. [code] using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { string Name; string Age; string Country; string City; string Zip_Code; string Addresse; Console.WriteLine("I would like to recieve some information from you. What's your full name?"); Name = Console.ReadLine(); Console.Clear(); Console.WriteLine("How old are you?"); Age = Console.ReadLine(); Console.Clear(); Console.WriteLine("Which country do you live in?"); Country = Console.ReadLine(); Console.Clear(); Console.WriteLine("Which city do you live in?"); City = Console.ReadLine(); Console.Clear(); Console.WriteLine("What zip code do you live in?"); Zip_Code = Console.ReadLine(); Console.Clear(); Console.WriteLine("What's you addresse?"); Addresse = Console.ReadLine(); Console.Clear(); [B]Console.WriteLine("Name: {0}/n Age: {1}/n Country: {2}/n City: {3}/n Zip Code: {4}/n Addresse: {5}", Name, Age, Country, City, Zip_Code, Addresse);[/B] Console.ReadKey(); } } } [/code] If anyone could tell me why it doesn't skip a line at the second to last line of code, It'd be appreciated
So your final aim is XNA?
[QUOTE=jack5500;35512975]So your final aim is XNA?[/QUOTE] I have no clue what XNA is used for. I can only assume it's a language ^^
Never use goto. Try and split your stuff into methods. [editline]10th April 2012[/editline] XNA is a for making games.
[QUOTE=Nisd;35513001]Never use goto. Try and split your stuff into methods. [editline]10th April 2012[/editline] [B]XNA is a for making games.[/B][/QUOTE] Then yeah, final goal would be XNA
[QUOTE=Doom;35512988]I have no clue what XNA is used for. I can only assume it's a language ^^[/QUOTE] It's a way to make games but don't even think about that now. Keep playing with console apps, learn for loops if statements while loops switch statement and how to create methods and classes. Then play around with forms. They're a really good way to get into the idea of methods and get you out of simple procedural stuff. THEN you can think about games.
[QUOTE=AngryChairR;35513053]It's a way to make games but don't even think about that now. Keep playing with console apps, learn for loops if statements while loops switch statement and how to create methods and classes. Then play around with forms. They're a really good way to get into the idea of methods and get you out of simple procedural stuff. THEN you can think about games.[/QUOTE] OR 1. master C# forms 2. learn Lua + Löve 3. master XNA Löve is pretty similar to XNA. Might be useful
XNA is a pretty awesome framework for making games. It's not hard to use, but be sure you have a really strong grasp of all the fundamentals of C# before attempting to use it. Don't get frustrated, learning to program has a pretty steep learning curve but once you get passed a certain point something just clicks and you realize you can create just about anything you can think of with enough time, planning, and research. Good luck!
All right, thanks a lot guys :) Lua is used for mods in Garrys Mod, right?
[QUOTE=Doom;35513111]All right, thanks a lot guys :) Lua is used for mods in Garrys Mod, right?[/QUOTE] I would advise against Lua.
[QUOTE=Doom;35513111]All right, thanks a lot guys :) Lua is used for mods in Garrys Mod, right?[/QUOTE] Lua is a scripting language that is embedded in a lot of applications, gmod included. It's often used for modding and/or creating scripts that simplify processes. There is also a good 2d framework that uses lua called love (google love2d to find it) and it's also pretty solid like XNA. Although if the c# syntax isn't giving you any trouble i suggest bypassing love and going straight into xna when the time is right.
Thanks everyone, this definitely helped out a bunch!
[QUOTE=Nisd;35513001]Never use goto.[/QUOTE] Never use goto in a bad way, it has its uses.
[QUOTE=Overv;35513335]Never use goto in a bad way, it has its uses.[/QUOTE] True, every rule has an exception.
[QUOTE=Nisd;35513937]True, every rule has an exception.[/QUOTE] That's why we use try { rule; } catch () {} block.
I'd recommend finding some source to learn programming, as someone mentioned, then, if you want to learn XNA, this is a good source: [url]http://rbwhitaker.wikidot.com/xna-tutorials[/url] Start with the c# tutorials!! Then go to 2D or something.
[QUOTE=Darwin226;35514122]That's why we use try { rule; } catch () {} block.[/QUOTE] Especially funny since one of the few remaining uses of goto nowadays is to implement exceptions in C.
[QUOTE=Doom;35512874]Here's a quick preview of what I've already coded To cut it short, it asks for a bunch of information, saves it and use it later on. [code] [B]Console.WriteLine("Name: {0}/n Age: {1}/n Country: {2}/n City: {3}/n Zip Code: {4}/n Addresse: {5}", Name, Age, Country, City, Zip_Code, Addresse);[/B] [/code] If anyone could tell me why it doesn't skip a line at the second to last line of code, It'd be appreciated[/QUOTE] \n, not /n.
I found these videos useful [URL="http://channel9.msdn.com/Series/C-Sharp-Fundamentals-Development-for-Absolute-Beginners"]http://channel9.msdn.com/Series/C-Sharp-Fundamentals-Development-for-Absolute-Beginners[/URL] I'm completely new to programming and chose C# as my first language. Like others have said, its a massive learning curve but it becomes a little bit easier after constant practice.
You'd better choose C first to learn how processors work, optimization tricks and syntax.
I never understood why people insist on chiming in on these threads when the OP already has all the info they need. Adding more voices suggesting Lua, C and other assorted bullshit just confuses new people. Leave it aht. [editline]13th April 2012[/editline] [img]http://pinkie.ponychan.net/chan/files/src/133269720257.jpg[/img]
[QUOTE=SiPlus;35556020]You'd better choose C first to learn how processors work, optimization tricks and syntax.[/QUOTE] Did you learn how to be a bike mechanic before you learned to ride?
HeadFirst C# is also a very usefull book to start learning c# aswell as Rob Miles C# Yellow Book (free download). If you can understand the basic Object Oriented ideas of c# then you are on the right track.
[QUOTE=Overv;35513335]Never use goto in a bad way, it has its uses.[/QUOTE] I remeber the first time we used visual basic in sixth form, back when I was 16. I trolled my computing teacher so hard by making the thing we had to do with a complicated maze of goto's. The expression on his face was priceless when he was looking through it. [editline]14th April 2012[/editline] [QUOTE=SiPlus;35556020]You'd better choose C first to learn how processors work, optimization tricks and syntax.[/QUOTE] I'm fed up with people saying things like this. "Learn X before Y because it helps" Learn whatever you want to use. It's completely ridiculous and unnecessary to learn C before C#. The funny thing is that there are 2 ends of this spectrum of poor suggestions. On one end are the people suggesting "start with python/visual basic/lua because its easy!" when someone says they want to learn something like C++, and for some reason people have this opinion that it's impossible to learn as a first language. On the other end are the people suggesting "start with C/C++/Asm because it's fundamental!" when someone says they want to learn something like C# or Java. The logical solution for anyone wanting to learn X language is learn X language in 99% of situations.
I actually tried to learn VB before C#... It didn't help, it just confused the fuck out of me due to it's god awful syntax. Yeah, C# is a great language. Still my favourite to date. If you ever need any help just PM me.
Sorry, you need to Log In to post a reply to this thread.