C# Faq For C++ Programmers By Andy McMullan


C# Faq For C++ Programmers

By Andy McMullan
The C# FAQ for C++ programmers was first posted in Aug 2000, and is regularly updated. It answers many of the questions that C++ developers have when they first encounter C#. I recommend that you read the .NET Framework FAQ before reading this one.
What is C#?
C# is a programming language designed by Microsoft. It is loosely based on C/C++, and bears a striking similarity to Java. Microsoft describe C# as follows:
"C# is a simple, modern, object oriented, and type-safe programming language derived from C and C++. C# (pronounced 'C sharp') is firmly planted in the C and C++ family tree of languages, and will immediately be familiar to C and C++ programmers. C# aims to combine the high productivity of Visual Basic and the raw power of C++."
How do I develop C# apps?
The (free) .NET SDK contains the C# command-line compiler (csc.exe). Visual Studio has fully integrated support for C# development. On Linux you can use Mono.
Does C# replace C++?
There are three options open to the Windows developer from a C++ background:
  • Stick with standard C++. Don't use .NET at all.
  • Use C++ with .NET. Microsoft supply a .NET C++ compiler that produces IL rather than machine code. However to make full use of the .NET environment (e.g. garbage collection), a set of extensions are required to standard C++. In .NET 1.x this extended language is called Managed Extensions for C++. In .NET 2.0 ME C++ has been completely redesigned under the stewardship of Stan Lippman, and renamed C++/CLI.
  • Forget C++ and use C#.
Each of these options has merits, depending on the developer and the application. For my own part, I intend to use C# where possible, falling back to C++ only where necessary. ME C++ (soon to be C++/CLI) is very useful for interop between new .NET code and old C++ code - simply write a managed wrapper class using ME C++, then use the managed class from C#. From experience, this works well.

1 comment:

  1. Howdy I am so glad I found your webpage, I really found you by accident, while I
    was browsing on Aol for something else, Anyways I am here
    now and would just like to say thanks a lot for a fantastic post and a all round thrilling
    blog (I also love the theme/design), I don't have time to read it all at the minute but I have book-marked it and also added your RSS feeds, so when I have time I will be back to read a lot more, Please do keep up the fantastic work.
    my webpage - London C# ASP.NET MVC Developer Brad McAllister

    ReplyDelete

Thanks