7 Replies - 3145 Views - Last Post: 24 July 2011 - 06:35 PM Rate Topic: -----

#1 2pi  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 22-January 10

Time to learn c#

Posted 20 July 2011 - 04:28 PM

So,I want do join a xna contest but I need to do a demo game until september first.However I don't know how to program in c# :dozingoff: I was thinking here:Can I learn c# in 1 or 2 days?(the next weekend).But I'm not asking about learn programming in 2 days,I'm a c and python programmer,I just want to learn the c# syntax(enough to create a simple 2d casual game).Is this possible?Is there a tutorial that can make me able to join this contest(I already have game development experience in unity3d)?

So my question is:Is there a tutorial that can make able to a programmer learn c# in a weekend?

P.S.:Sorry for my bad English I'm brazillian :notify:

Is This A Good Question/Topic? 0
  • +

Replies To: Time to learn c#

#2 Sergio Tapia  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1253
  • View blog
  • Posts: 4,168
  • Joined: 27-January 10

Re: Time to learn c#

Posted 20 July 2011 - 05:04 PM

Can I learn c# in 1 or 2 days?

Since you have a background in C and Python, you might grasp the syntax quick enough.

As for a tutorial, read Head First C# for a quick dive in to the language, or something on C# from Apress or Wrox.
Was This Post Helpful? 1
  • +
  • -

#3 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5578
  • View blog
  • Posts: 11,918
  • Joined: 02-June 10

Re: Time to learn c#

Posted 20 July 2011 - 05:12 PM

*
POPULAR

C is not object oriented. It really isn't all that event-driven. Its more procedural and message-pump oriented.

And you want to learn C# well enough to write in game... in the next 6 weeks.

I'm not sure if I should feel insulted or not. I don't think I care for the idea that someone thinks what I do for a living can be picked up to that level in a month.

It isn't just language syntax you need to pick up, but several major concepts about objects/classes, events, delegates and inheritance. Maybe Python already has that. I don't know Python. If so that would give you a good start.

Maybe your skills with C and Python really are that great and you CAN pick it up that quickly.

Why don't you look at these tutorials and see if they are child's play or total gibberish. That should help you decide if this is something you can do.

The tutorials below walk through making an application including inheritance, custom events and custom controls, object serialization and more.
Bulding an application - Part 1
Building an application - Part 2
Quick and easy custom events
Separating data from GUI - PLUS - serializing the data to XML
Passing values between forms/classes

Beyond that, here is my long list of beginner tutorials and references. I know you aren't a beginner programmer, but you are a self-proclaimed C# beginner. In theory you should be able to breeze through the tutorials. If you can cover year's worth of tutorials in a week, that will leave you 5 weeks to build a game.


Standard resources, references and suggestions for new programmers.


I would recommend you start with "Hello World" just like the other million+ coders out there. Then work your way up to the more advanced tasks like this.

The problem with taking on large, complex tasks like this when you are new to coding is that
  • it will frustrate you to the point of quitting,
  • you don't know enough about coding to know where to start or in what direction to design your program
  • You risk learning via the 'Swiss cheese' method where you only learn certain bits and pieces for the one project but have huge holes in your education.


I am going to guess that you are trying to teach yourself C# without much guidance, a decent book or without knowing where to look. Sometimes just knowing where to look can make all the difference. Google is your friend.
Search with either "C#" or "MSDN" as the first word: "MSDN Picturebox", "C# Custom Events", "MSDN timer" etc.

But honestly, just typing away and seeing what pops up in Intellisense is going to make your self-education take 20 years. You can learn by trying to reverse engineer the language through banging on the keyboard experimentation - or you can learn by doing the tutorials and following a good "How to learn C#" book.

Free editions of Visual Studio 2010

May I suggest picking up a basic C# introductory book? There are so many great "How do I build my first application" tutorials on the web... There are dozens of "Learn C# in 21 days", "My first C# program" type books at your local book seller or even public library.

D.I.C. C# Resource page Start here
Intro to C# online tutorial then here...
C# control structures then here.
MSDN Beginner Developer video series
MSDN video on OOP principals, making classes, constructors, accessors and method overloading
MSDN Top guideline violations, know what to avoid before you do it.
Design patterns as diagrams

The tutorials below walk through making an application including inheritance, custom events and custom controls, object serialization and more.
Bulding an application - Part 1
Building an application - Part 2
Quick and easy custom events
Separating data from GUI - PLUS - serializing the data to XML
Passing values between forms/classes

I hate sending people to another site when we have such good tutorials here, but this series shouldn't be overlooked.
Programming OOP in C# - Part 1
Programming OOP in C# - Part 2
Programming OOP in C# - Part 3
Programming OOP in C# - Part 4
Programming OOP in C# - Part 5

Working with environmental variables
'Why do we use delegates?' thread

Debugging tutorial
Debugging tips
Debugging in detail
Great debugging tips
It still doesn't work, article

Build a Program Now! in Visual C# by Microsoft Press, ISBN 0-7356-2542-5
is a terrific book that has you build a Windows Forms application, a WPF app, a database application, your own web browser.

C# Cookbooks
Are a great place to get good code, broken down by need, written by coding professionals. You can use the code as-is, but take the time to actually study it. These professionals write in a certain style for a reason developed by years of experience and heartache.

Microsoft Visual Studio Tips, 251 ways to improve your productivity, Microsoft press, ISBN 0-7356-2640-5
Has many, many great, real-world tips that I use all the time.

Writing a text file is always one of the first things people want to do, in order to store data like high-scores, preferences and so on
Writing a text file tutorial.
Reading a text file tutorial.

And everyone always wants to connect to a database, right out of the gate so
Database tutorials right here on DIC

These are just good every-day references to put in your bookmarks.
MSDN C# Developers Center with tutorials
Welcome to Visual Studio

Have you seen the 500+ MSDN Code Samples? They spent a lot of time creating samples and demos. It seems a shame to not use them.

Let me also throw in a couple tips:
  • You have to program as if everything breaks, nothing works, the cyberworld is not perfect, the attached hardware is flakey, the network is slow and unreliable, the harddrive is about to fail, every method will return an error and every user will do their best to break your software. Confirm everything. Range check every value. Make no assumptions or presumptions.

  • Take the extra 3 seconds to rename your controls each time you drag them onto a form. The default names of button1, button2... button54 aren't very helpful. If you rename them right away to something like btnOk, btnCancel, btnSend etc. it helps tremendously when you make the methods for them because they are named after the button by the designer.
    btnSend_Click(object sender, eventargs e) is a lot easier to maintain than button1_click(object sender, eventargs e)

  • You aren't paying for variable names by the byte. So instead of variables names of a, b, c go ahead and use meaningful names like Index, TimeOut, Row, Column and so on. You should avoid 'T' for the timer. Amongst other things 'T' is commonly used throughout C# for Type and this will lead to problems. There are naming guidelines you should follow so your code confirms to industry standards. It makes life much easier on everyone around you, including those of us here to help. If you start using the standards from the beginning you don't have to retrain yourself later.

  • Learn how to search the 'net for examples. How to do a good search that will get you targeted answers.

  • Try to avoid having work actually take place in GUI control event handlers. It is usually better to have the GUI handler call other methods so those methods can be reused and make the code more readible.
    btnSave(object sender, eventargs e)
    {
        SavePreferences();
    }
    
    SaveMenuItem(object sender, eventargs e)
    {
        SavePreferences();
    }
    
    SaveContextMenu(object sender, eventargs e)
    {
        SavePreferences();
    }
    
    Form1_Closing(object sender, eventargs e)
    {
        if (IsDirty) SavePreferences();
    }
    


  • I strongly suggest installing VMware or some other virtualization technology on your development PC so you can create a couple virtual computers for testing. This would allow you to debug and test inside: WinXP32, XP64, Vista, Win7x32, Win7x64... etc. without having to actually have 5 physical PC's. Visual Studio will let you send the debug directly into one of these virtual machines so you can watch it operate, check its variables, see the crashes and so on just as if it were debugging on your real machine.

Was This Post Helpful? 6
  • +
  • -

#4 2pi  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 22-January 10

Re: Time to learn c#

Posted 22 July 2011 - 11:52 AM

Hey man thanks for this awesome answer,I'll go deep on c#,but I just want an introduction on the language by now,because I want to get a xbox 360(here in Brazil it's very expansive).So i don't care about develop a workout based code in this project(it only need to work).
So that's all,this game'll work as my first experience in c# journey(I need to find an experience to improve my poor English skills)
Was This Post Helpful? 0
  • +
  • -

#5 Lemur  Icon User is offline

  • Pragmatism over Dogma
  • member icon


Reputation: 1377
  • View blog
  • Posts: 3,501
  • Joined: 28-November 09

Re: Time to learn c#

Posted 23 July 2011 - 05:12 PM

I will warn you that XNA can be utter hell if you're not extremely proficient in math and physics. You may be able to learn C# in a few days, but to be to a point where you can effectively use it will take years unless you have a substantial amount of background.
Was This Post Helpful? 0
  • +
  • -

#6 DivideByZero  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 238
  • View blog
  • Posts: 551
  • Joined: 02-December 10

Re: Time to learn c#

Posted 24 July 2011 - 05:09 AM

View PostLemur, on 23 July 2011 - 05:12 PM, said:

I will warn you that XNA can be utter hell if you're not extremely proficient in math and physics. You may be able to learn C# in a few days, but to be to a point where you can effectively use it will take years unless you have a substantial amount of background.

He's right, 2D is fine.
But if you move to 3D, prepare to pull out your hair in frustration :)
Was This Post Helpful? 0
  • +
  • -

#7 2pi  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 22-January 10

Re: Time to learn c#

Posted 24 July 2011 - 04:18 PM

I've found this book:
http://www.amazon.co...0/dp/0735651574
Seems insane,but can I learn something with this book?You know enough to do a small game(learn xna and c# in 465 by $19 seems insane to me)
Was This Post Helpful? 0
  • +
  • -

#8 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5578
  • View blog
  • Posts: 11,918
  • Joined: 02-June 10

Re: Time to learn c#

Posted 24 July 2011 - 06:35 PM

Whether or not you can learn from it is rather up to you. We don't know if you learn well from books.

You'll notice that another book in the "Learning programming NOW" series is one of my recommended reading links I gave you earlier. That was was just the C# language, and not the XNA framework. But it is a good series.

Given your short time frame from when you started this thread through... Shouldn't you have already learned everything there was about C# and XNA by now? I mean you had given yourself 2 whole days to learn C#. I would have thought you would have been done with the game by now.
Was This Post Helpful? 3
  • +
  • -

Page 1 of 1