What is C# like?

Started by
9 comments, last by GameDev.net 18 years, 4 months ago
I'm currently learning C++ to eventually make some games, and maybe because it's useful later in my professional life BUT; in the tread "Is C++ over-used in amateur game development?" everyone was whining about C++ and how much better C# is. So my question is, how much more high-level is C# than C++? And in what paradigm is it? I've used C, C++, Java, Haskell, Prolog and Assembly so far, in school and such. The reason I chose C++ for my games is I don't like Java very much (and in my opinion so far, they are pretty similar after all, maybe one is more likely to produce bugs in C++ but... similar) and there is more online tutorials and other stuff for C++. So what about the other languages? I didn't see myself writing anything in Prolog (hehe), that's a pain, and it's slow aswell. Haskell then. I liked haskell but I didn't see myself writing anything in Haskell either because it seemed to me that graphics and Haskell didn't go well together (I may be very wrong). Additionally I never heard of a game made in Haskell so that may be part of the reason. Of course I had heard of lots of games made in C++. In the tread "Is C++ over-used in amateur game development?" everyone though seemed to have the same favourite: C#. So, now I wonder: What is C# like? OOP? Functional (like Haskell)? Something else? Thanks!
Advertisement
C# and C++ are very similar but there is much less you need to do in C#, to do specific tasks so in a sense it is higher up then C++. C# also comes with all of these pre-built objects you can continually reuse.

Not to mention there is what most beginning programmers really need in my opinion and that is a garbage collector. Many new C++ programmers have no clue that they are even causing memory leaks and even what a memory leak is.

C# also handles weird expressions, that a new programmer might use that could cause undesirable effects when using C++, due to the way the assembly is generated for unmanaged code. Such as when you do ++x, there was a thread about some of these wild expressions awhile back.

I can't remember any specific examples, some of the examples that were addressed would compile differently on various compilers. C# handles these expressions without any strange errors like that.

There are also delegates which are suppose to be safer pointers basically and they are sort of.

Lots of more safe things that restrict the programmer in some ways, but in other ways would really protect a new programmer.

Quote:Original post by tufflax
In the tread "Is C++ over-used in amateur game development?" everyone though seemed to have the same favourite: C#. So, now I wonder: What is C# like? OOP? Functional (like Haskell)? Something else?

Extremely OOP.

[Edited by - GDKnight on December 12, 2005 10:47:44 PM]
- GDKnight
Ok, sounds nice. I will look into it.
A few games in Haskell. You might also want to look at this page, which has some more applications written in Haskell.
C# is effectively Java++. It follows many of the same concepts but fixes many problems and adds more flexibility.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
Is C# only usable in the Microsoft .NET world?
Quote:Original post by Anonymous Poster
Is C# only usable in the Microsoft .NET world?
No, it isn't.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
You might take interest in the Tao Framework if you're looking to get into OpenGL with .NET. SDL.NET is also very nice to give SDL a high-end object oriented interface.
Rob Loach [Website] [Projects] [Contact]
For a mario styled game using C# and MDX, take a look at Texas Quest. If you look though that, you can get an idea of a 2D platform C# game using MDX. Quite cool if I might say, I'll be using that to read over before I start down the line. The actual game comes with code and is around 55MB, link at the bottom.
I can't say much about game development but it certainly makes coding Windows applications much easier. When I used MFC, I always felt like it was stuck right between C and an object oriented design. You know, on one hand you had a CDialog class and on the other you were passing DWORD HWND pointers everywhere. Then C# came along and abstracted all that into a more unified framework. Not that thrilled with #Develop but I like how Visual Studio (2005 especially) more often than not seems to know what you mean to do instead of sending you off into dependency hell (see "including windows.h before winsock.h") for arbitrary reasons.

I still like C++ alot, mind you, for console applications. I also had better luck with graphics libraries in C++ as well (not that I've tried many in C# yet...). For regular Windows applications though, C# is a no brainer IMO. Just my two cents though.

This topic is closed to new replies.

Advertisement