Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Learning C# after C++

Tags:

In a progression of languages, I have been learning C and C++. Now I would like to learn C#. I know there are some drastic differences between them - such as the removal of pointers and garbage collection. However, I don't know many of the differences between the two.

What are the major differences that a C++ programmer would need to know when moving to C#? (For example, what can I use instead of STL, syntactic differences between them, or anything else that might be considered important.)

like image 254
Cristián Romo Avatar asked Nov 10 '08 02:11

Cristián Romo


People also ask

Is C an easy language to learn?

While C is one of the more difficult languages to learn, it's still an excellent first language pick up because almost all programming languages are implemented in it. This means that once you learn C, it'll be simple to learn more languages like C++ and C#.

How do I start learning C?

Get started with C. Official C documentation - Might be hard to follow and understand for beginners. Visit official C Programming documentation. Write a lot of C programming code - The only way you can learn programming is by writing a lot of code.

Is C hard to learn?

C is more difficult to learn than JavaScript, but it's a valuable skill to have because most programming languages are actually implemented in C. This is because C is a “machine-level” language. So learning it will teach you how a computer works and will actually make learning new languages in the future easier.

Should I learn C or C++ first?

There is no need to learn C before learning C++. They are different languages. It is a common misconception that C++ is in some way dependent on C and not a fully specified language on its own. Just because C++ shares a lot of the same syntax and a lot of the same semantics, does not mean you need to learn C first.


2 Answers

C# for C++ Developers is a great place to start. It is a table that lists the most important comparisons between the two languages.

Once you have explored some of these differences, you might choose a self-contained project you have written in the past in C++, and re-write it in C#. In your first pass, you will probably just end up translating directly across, using the same design and algorithms. As you become more comfortable with C#, you will recognize ways to take advantage of language features only available in C#, as well as the incredibly versatile .NET Framework.

like image 144
Jeff Hillman Avatar answered Sep 18 '22 20:09

Jeff Hillman


I think it's important to note that pointers weren't really removed from C#, but that they still exist, they are everywhere, and they are called references.

like image 38
Greg Hewgill Avatar answered Sep 17 '22 20:09

Greg Hewgill