Migrating to C# - Troubles

Started by
1 comment, last by phil05 19 years, 1 month ago
Recently, I decided to learn some C#, primarily because I heard good things about it (and also because there's an open source program written in it. If anyone happens to be interested, the source code can be found here and instructions here.) I downloaded VC# 2005 Beta, and I have a couple questions/concerns. First and foremost, why can't I run console programs as normal? Instead of getting the traditional black console window, the entire program takes place in a dockable toolbar inside Visual Studio - this is obviously a cheap alternative because the size of that window is small. I do get a console window, but it's empty - all output goes to the little toolbar instead (labeled "Console"). How can I get it to run in the normal console window? Second, I've dealt very little with C#, but have OK experience with C++. Will this migration be hard? Is it even worth it? Thirdly, is there a performance hit for using a managed language? And lastly, is conversion from C# to C++ simple and straightforward, or are the differences between the languages significant enough to make this next to impossible? Thanks for any help!
.:<<-v0d[KA]->>:.
Advertisement
Quote:Original post by v0dKA
First and foremost, why can't I run console programs as normal? Instead of getting the traditional black console window, the entire program takes place in a dockable toolbar inside Visual Studio - this is obviously a cheap alternative because the size of that window is small. I do get a console window, but it's empty - all output goes to the little toolbar instead (labeled "Console"). How can I get it to run in the normal console window?

That's odd. I'm using VS.NET 2005 beta 1 and it doesn't do that; maybe it's a VC#-only thing I'm not aware of.

Quote:Second, I've dealt very little with C#, but have OK experience with C++. Will this migration be hard? Is it even worth it?

I programmed primarily in C++ from beginning of high school until about two years ago for a total of ~6 years. I tried C# and loved it, and now I do pretty much all of my coding in it. Migration wasn't difficult, it was mainly syntax and familiarization with the .NET libraries. It looks like a lot to learn but I had a lot of experience with Win32, which helped with the System.Windows.Forms namespace, and the rest were easy to pick up.

Quote:Thirdly, is there a performance hit for using a managed language?

Yeah, since programs are JITed at runtime. There's also garbage collection and probably other things, but for everything I've used it for the performance hit has been negligable.

Quote:And lastly, is conversion from C# to C++ simple and straightforward, or are the differences between the languages significant enough to make this next to impossible?
I haven't tried going C# -> C++. The basic syntax is similar enough that the general structure should be the same. The most difficult part would probably be finding unmanaged replacements for .NET classes. If you meant going from C++ -> C#, I don't know either. All C++ plus .NET work I've done have been in compiling the C++ code as managed C++, which is then used from C# as if it's another .NET assembly (it actually is, in fact). This compilation seems amazingly simple based on the stuff I've done.

Welcome to C#! It's very easy to migrate over. The only solution for a console window is to open the exe file in the bin directory of your project's folder. So you compile in the IDE, and execute it in your folder. It may be a little annoying, but it works. The reason I like the console more is because you can actually see what your output looks like. If anyone has a solution to this, I 2nd would like to know :)

When you compile to IL, it does the JIT for you. Next, when you execute it, it compiles one more time with the CLR which optomizes the code for that particular processor. So, all in all, it does a lot for you. All that matters afterwards is how efficient you are in C#.

This topic is closed to new replies.

Advertisement