Learning C# in ... a day
Hey I need to learn everything about C# fast (well actually in 2weeks) anyways I went to the creators club website did the 2d tutorials its way to slow I already know all that basic stuff like loops from other languages.
About me ..
I have been C++ for 3 years now
Experienced with directX HLSL and opengl
So if someone can recommend a good website / book that would be nice.
Otherwise I think I'm just going to try to make a simple game like pong or something with C# and research stuff as I go.
If you really are experience in C++, you should have no problem with C#. It is almost the same thing but C# is ALOT easier. Also, I reccomend doing XNA too:
C#:http://msdn.microsoft.com/en-us/library/67ef8sbd.aspx
XNA: http://msdn.microsoft.com/en-us/library/bb198548.aspx
C#:http://msdn.microsoft.com/en-us/library/67ef8sbd.aspx
XNA: http://msdn.microsoft.com/en-us/library/bb198548.aspx
The book "Professional C#" has a chapter for C++ programmers if I remember correctly. Make sure you pick up the correct/latest edition.
Don't worry about the language; if you are a solid C++ programmer it will come naturally. Worry about the platform/APIs.
The book is partially about C# and partially about the platform and a pretty good read.
Don't worry about the language; if you are a solid C++ programmer it will come naturally. Worry about the platform/APIs.
The book is partially about C# and partially about the platform and a pretty good read.
Yeah thats what I meant when I was makeing this thread. I need to learn how to work the api. Like the texture2d and SOUND (sorry about the emphasis just had a bad experience with xact *twich*)
Learn about generics, as they are a bit different in C# as compared to C++, and are a point of some frustration for hardened C++ programmers who are used to the freedom of templates. Learn about events/delegates. Learn about things in the System.Collections namespace. It is likely also a good idea to browse through System.IO a bit. DirectX isn't directly usable in C#, but there is XNA and SlimDX which facilitate this greatly [the later of which is created by some of our brothers here at gamedev.net]. SlimDX will let you carry over pretty much all of your DirectX know-how. OpenGL isn't directly usable, but there is a library called Tao [a very short discussion about XNA alternatives can be found here]. Ditch the concept of manual memory management, and don't fight it. Just look into System.IDisposable for interop stuff. Look into a difference between value types and reference types [struct and class respectively] as now they actually do have some pretty major differences. It is a little detail as well, but you would do well to learn a bit about attributes, though specific kinds will likely be unimportant for the time being. Just breeze through it to know what you're seeing in all the documentation. It also doesn't come up too terribly often, but P/Invoke [platform invoke] is a good thing to be at least passingly familiar with.
There are some parts of .NET that are a real pain to work with, so you might as well be aware that such a thing is coming. The biggest of which I can think of off the top of my head is dealing with binary data, and squeezing it into structures/classes. C++ made it easy [just cast it over], C# is another story all together, and you really don't have any *good* options for solving this problem. For this reason, you will likely find yourself in the same position as I found myself in, which is building a few little helper doodads in C++/CLI to use in C# that will simplify this and certain other things, especially when it comes to dealing with C#'s more restrictive definition of generics [a restriction that apparently C++/CLI can skirt in certain situations].
There are lots of things in C# that don't really have an equal in C++ just yet [unless you count 0x, which fills in some of the gaps]. Such things as lambda expressions, in-code sql-like queries, and the other more recently added things that are not directly expressible in C++ as well are very rarely used, and you can familiarize yourself with this stuff as you need to [you are not likely to actually encounter any of it outside of the occasional corner case]. C# is very much a living language though, and sees new features added at a pretty fast pace when compared to other languages
Looking through threading is likely also a good idea, especially the lock keyword, which presents you with a somewhat restrictive scoped primitive.
If you are anything like me, the source of greatest frustration is going to be transitioning from the use of C++ templates to C# generics. Hit this section hard, as there are a *lot* of things C# generics can't do, that when they first crop up seem very unintuitive [such as the inability to use the sizeof operator on a element of a generic type]. MSDN was my primary learning site, and I covered the basics of the language over the course of a saturday afternoon some time ago. It really is what I would consider as the best source of "i found this goofy thing and i need to know what it is" and "I want to do this" kind of information.
Good luck. C# is a piece of cake for a hardened C++ programmer so long as generics are out of the way, and the .NET class library is a pleasure to use. When dealing with generics, there will be much bitching on your part [trust me....] since you are undoubtedly more accustomed to the highly permissive C++ equivalent. Everything I've mentioned here can be trivially found on MSDN, so I didn't litter links all over the place. Wikipedia also has a quick run-down of language features found here, which would really be the first stop for me. It will give you a once-over of all the syntax so you know what to search for if you run into something that looks funky. [As a side note about syntax, if you are anything like me, you are going to love the edge that properties give you, which will finally get all of those "make data private and provide getters/setters that ugly up your code" people off your back once and for all]
It has nothing to do with 'learning the language', but there are some articles on MSDN about best practices for writing efficient C# code that will help you realize what parts of your C++ knowledge would be best left at the door step with respect to operating more efficiently in a managed environment.
There are some parts of .NET that are a real pain to work with, so you might as well be aware that such a thing is coming. The biggest of which I can think of off the top of my head is dealing with binary data, and squeezing it into structures/classes. C++ made it easy [just cast it over], C# is another story all together, and you really don't have any *good* options for solving this problem. For this reason, you will likely find yourself in the same position as I found myself in, which is building a few little helper doodads in C++/CLI to use in C# that will simplify this and certain other things, especially when it comes to dealing with C#'s more restrictive definition of generics [a restriction that apparently C++/CLI can skirt in certain situations].
There are lots of things in C# that don't really have an equal in C++ just yet [unless you count 0x, which fills in some of the gaps]. Such things as lambda expressions, in-code sql-like queries, and the other more recently added things that are not directly expressible in C++ as well are very rarely used, and you can familiarize yourself with this stuff as you need to [you are not likely to actually encounter any of it outside of the occasional corner case]. C# is very much a living language though, and sees new features added at a pretty fast pace when compared to other languages
Looking through threading is likely also a good idea, especially the lock keyword, which presents you with a somewhat restrictive scoped primitive.
If you are anything like me, the source of greatest frustration is going to be transitioning from the use of C++ templates to C# generics. Hit this section hard, as there are a *lot* of things C# generics can't do, that when they first crop up seem very unintuitive [such as the inability to use the sizeof operator on a element of a generic type]. MSDN was my primary learning site, and I covered the basics of the language over the course of a saturday afternoon some time ago. It really is what I would consider as the best source of "i found this goofy thing and i need to know what it is" and "I want to do this" kind of information.
Good luck. C# is a piece of cake for a hardened C++ programmer so long as generics are out of the way, and the .NET class library is a pleasure to use. When dealing with generics, there will be much bitching on your part [trust me....] since you are undoubtedly more accustomed to the highly permissive C++ equivalent. Everything I've mentioned here can be trivially found on MSDN, so I didn't litter links all over the place. Wikipedia also has a quick run-down of language features found here, which would really be the first stop for me. It will give you a once-over of all the syntax so you know what to search for if you run into something that looks funky. [As a side note about syntax, if you are anything like me, you are going to love the edge that properties give you, which will finally get all of those "make data private and provide getters/setters that ugly up your code" people off your back once and for all]
It has nothing to do with 'learning the language', but there are some articles on MSDN about best practices for writing efficient C# code that will help you realize what parts of your C++ knowledge would be best left at the door step with respect to operating more efficiently in a managed environment.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement