Sign in to follow this  

[.net] Getting started with C# and .NET

This topic is 4392 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello. I recently downloaded several of Mircrosoft's free Visual Studio 2005 beta applications, including Microsoft Visual C# 2005. I heard about C# awhile ago and was quite interested. I already know C++ and I've been dabbling in OpenGL. At the moment, I'm still fleshing out an interesting engine and class library for SDL. Anyway, I've been reading a few short tutorials about C# and am trying to put together some Windows forms applications. I wanted to know what C# books and references anyone would recommend for me. I'd like to develop games using C#. It seems that both DirectX and even OpenGL can be used with C# and .NET. I'm also interested in learning how to develop forms applications. Now that I think about it, I have a question about using C#. I have an application with a main form and a few small options dialogs. What's the best way to transmit information between the main form and these dialogs? Could I just make the controls of the dialogs public and access them and their values from within the main form class, or is this bad practice? Thanks!

Share this post


Link to post
Share on other sites
This is my personal opinion, but I not to access information from the dialogs by accessing the controls themselves. I think the controls should always be private. Instead, I create properties and implement the "get" and "set" parts. That way, something outside the dialog can't mess with the values in the controls directly.

So you would have something like:

public string Filename
{
get { return m_textBox.Text; }
set { m_textBox.Text = value; }
}

...and you could access it as myDialog.Filename in your main form. I think this makes the code look a bit cleaner, too. Of course, you can always write other code in your get and set functions (I would, in most cases anyway, clone arrays, etc.).

Oh, and if you're interested in using OpenGL, check out the Tao Framework. You can even grab a good number of the NeHe tutorials out of the source repository.

As for books, I guess it would depend on what you're wanting to learn as to which I would recommend. [smile] For Windows Forms programming, I would recommend Programming Windows with C#. For just general C# knowledge, I would recommend Inside C#, Second Edition and Programming C#.

HTH!

Share this post


Link to post
Share on other sites
Thanks for all the suggestions. I'll look into these books. :-)

I never thought to use properties for the control values! That's a much better idea, I think. I'm still a C# novice, so things like properties don't immediately come to mind for me.

Anyway, I'll give properties a try and see how it works. I'm sure it'll clean up the code a bit too.

Share this post


Link to post
Share on other sites
C# is a very nice language and you'll be sold on it if you've been playing with C++ for a while now. You'll end up typing less and have more productivity when it comes to the final product. I initially was a C++ fanatic, doing up small simple games like an asteroids clone and tetris. Once I got into C# programming, I was sold. It's an amazing language.

In order to use OpenGL with C#, you need to have some .NET bindings to the native C++ library. Luckly the guys over at the Tao Framework have done just that (Tao.OpenGl). For window management and input handling via SDL, you can either use the hard binding Tao.Sdl. If you don't want to deal with the hard bindings of Tao.Sdl (IntPtrs are a pain), you can use SDL.NET which adds an object oriented layer onto Tao.Sdl making it very nice and easy to use. Good luck and have fun!

Share this post


Link to post
Share on other sites
I haven't been using C# for too long, but I definitely like it.

I really like the layout of the C# programming language, and it takes object-oriented design to the next level. Of course, it just seems to be Microsoft's Java, but the .NET framework seems to be extremely powerful and ready to make professional, high-grade applications. (The most professional and powerful Java desktop application I've seen so far is the Eclipse Java IDE itself. Other than that, most Java desktop applications are weak and have a non-standard look and feel.)

I've never really done much coding in Java, but so far I can tell I like C# a lot. I'm most comfortable with C++, and that may be why.

I was amazed to see how easy it was to get OpenGL examples up and running in C# using the Tao framework, and intellisense makes writing OpenGL code a breeze in Visual C# 2005.

I plan on picking up a few books, but does anyone know of a good tutorial or document for people migrating to C# from C++?

Thanks for all of the help!

Share this post


Link to post
Share on other sites

This topic is 4392 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this