Learning resources for C#?

Very useful information, however, as always! Special thanks for the links to resources for learning C++. Hopefully C is a good start for learning С#. I really like creating demo games for arduboy, where different mechanics are used. Hopefully there will be a similar implementation in C#, because in the future I definitely want to switch to Unity, where this language is used :thinking:

1 Like

I believe Unity uses C# nowadays.

1 Like

You are absolutely right! Typical typo😬

Maybe you also have links to similar C # tutorials?

I’ve moved this to ‘off topic’ since it’s not really Arduboy related but someone else might find it useful.


I think you meant “Hopefully C++ is a good start for learning C#”.

C++ and C are two different languages.

The syntax of C++ and C# are very similar, but the semantics are very different, so you’ll have a head start, but you’ll still need to learn quite a bit.

Implementation of what?

Unfortunately not because it was so long ago that I learnt C# that I didn’t keep track of the things I was reading at the time. (Also I learnt C# off the back of already knowing Visual Basic.)

I can provide a handful of useful links though:

Incidentally, I actually learnt C# before I learnt C++.

Compared to C++, C# has fewer rules, fewer features and is a lot stricter. In terms of behaviour it’s somewhere between C++ and Java - it has more features than Java (e.g. first-class functions, the class-struct/value-reference split) but is higher level than C++ (e.g. it uses a GC, it has ‘yield’ blocks).

(Personally, I don’t like Unity much. I think frameworks like MonoGame are better.)

1 Like

I really thought C would be somewhat similar to C #. Thanks for the tip, these links will definitely come in handy! Thanks also for another example of a framework. I really want to start writing games for smartphones, and in the future for pc. I have always thought that only Unity is capable of fulfilling my wishes. Apparently it will be necessary to thoroughly study the issue of choosing an engine. C may not be similar to C #, but studying it gave me an understanding of the principle of programming and drew me into this area. As a tribute to the C language and Arduboy, I will continue to write various mini-games. Plus it’s insanely fun!

1 Like

Arduino uses C++, not C. C++ is not C. They are only partly compatible.

Probably because Unity has more money to throw at marketing. It’s a proprietary engine made by a for-profit company.
The Unity engine is only free for non-students if you have “Revenue or funding less than $100K in the last 12 months” (according to their ‘storefront’).

That’s going to be true for all programming languages.

There are a few different game engines and frameworks that can be programmed with C#, e.g. Stride, Godot, Urho. (Nowhere near as many as there are for C++ though.)

It’s also possible to use libraries that are C-ABI compatible (i.e. that use the cdecl calling convention on x86/x64 CPUs) from C# due to platform interop, but that’s a more advanced feature that can leak memory if you aren’t careful.

A good programmer should eventually learn several languages anyway. After a certain point, picking up new languages becomes much easier. (At least until you start encountering new ideas that you haven’t encountered before.)

The rules and syntax of programming languages differ, but the principles of programming don’t change. Similarly, when speaking a foreign language the words you use to express your thoughts change, but your thoughts and ideas don’t change.

Here’s some examples of a simple program in 9 different languages.

It’s also good practice, and you learn new things.

1 Like

God, this time it’s not a typo. I really read somewhere that arduino works in C and this thought stuck in my head so firmly that I did not even bother to look for a refutation.:man_facepalming: Thank you for correcting, now I have become even a little smarter. after choosing the engine, I will start looking for a community, in the hope that there will be the same responsive guys as in this community - by the way, another reason why I’ll hardly ever refuse from Arduboy.:black_heart:

1 Like

C# and Java are very old strictly typed languages. New trend is dynamic typing languages which helps you with types as you code, but not using types at runtime thus making the real polymorphism. If you want to really know OOP and patterns learn C++. If you want to be in trend with programming world learn TypeScript and Node.js.

1 Like

Thanks for the answer! I will definitely pay attention to trending languages. I will study C ++ anyway, because now I know that Arduboy games are built in this wonderful language. But it’s not entirely clear why exactly C ++ gives a clear idea of ​​OOP? I certainly suspected that this language is good to be the first, but is it really that good?

1 Like

Unfortunately I don’t doubt you did.

C and C++ have a degree of ‘compatibility’ - some code can be compiled both as C and C++ and will behave the same for both languages. That’s intentional, C++ was intended to be as compatible with C as possible.

Unfortunately, This leads a lot of people to just lump the two together, and in the worst case some people can’t even tell the two apart. But for all intents and purposes they are distinct languages and should be treated as such.


@PineappleComputer, I’m afraid I’m going to have to disagree with some of what you’ve said, and add some caveats to some other points.

They may be old, but they’re not stagnant.

Both are still being updated (e.g. C# 9.0 and Java 16 were both released this year), and both remain popular and widely used.

(Also, ‘strictly typed’ isn’t a proper technical term. I suspect you meant statically typed or strongly typed.)

A lot of people don’t realise it but dynamic typing is old too.

The second oldest high-level programming language, LISP, is dynamically typed, and nearly every form of BASIC (from the 60s, through the 70s and 80s and beyond) is dynamically typed.

The main reason there are more ‘old’ statically typed languages than dynamically typed languages is because dynamic typing uses more resources (memory, CPU power), and in the early days computers simply couldn’t afford the overhead. These days the cost can be significantly reduced, but not eliminated.

Many statically typed languages have aspects of dynamically typed languages though, when you take into account runtime type information and reflection capabilities. When accounting for reflection, both C# and Java could be considered dynamically typed. (C# even has a dynamic keyword.)

There are lots of languages that are suitable for learning object oriented programming. C#, Java and C++ are all suitable candidates, but far from the only ones.

The principles matter more than the language.

Trends come and go, but nearly all languages have their uses.

Statically typed languages are still heavily used, and different fields use different languages.

E.g. languages like Matlab, Wolfram and R are used almost exclusively for scientific research and mathematics-heavy fields. C and C++ are the favourites for embedded systems and game engines. By some miracle PHP remains popular for server-side scripting.

Whatever language you learn, as long as it’s not too obscure, there will be work to be had somewhere. (And if there isn’t, just learn another.)

There may even be a slight advantage to knowing an obscure language because there’s likely to be less competition. Some places are desperate for COBOL programmers because they need people to maintain their legacy systems.

Ultimately, as I said before, a good programmer should know more than one language, and a professional programmer should certainly know more than one language, and be prepared to learn more should their job require it.

TypeScript is actually a sort of hybrid of static and dynamic typing. Its runtime behaviour is fully dynamic, but its compilation phase has static checking (which is unusual for a dynamically typed language - traditionally they do no static type checking). I don’t expect it was the first to do this, but it’s probably the most well-known example.

Node.js isn’t actually a language, it’s a runtime environment. The language itself is JavaScript.

1 Like

Sorry to chime in to a thread I’m poorly equipped to contribute constructively to. However, I think you may have missed that pineappleComputer was not referring to C++ in the section you quoted @Pharap. Equally, your point could have gone way over my head :grin:!

2 Likes

Fair point, I flitted around the parts of my response so much I overlooked the #. (In fairness # is effectively two + overlayed. :P)

Fortunately my point still stands, the most recent version of C# is C# 9.0, released this year. (Modern C# has changed so much since I first learnt it that I sometimes struggle to read newer C# code without the reference to hand.)

I’ve amended the example.

1 Like

Cannot agree with this statement enough. I develop in Java and a little Python / C# at work and C++ (for Arudboy obvoiusly). The concepts are totally interchangeable. I regularly ask myself, ‘I know who to do in Java, how do I do that in ?’ My Google search history is littered with queries like ‘how to create a Java-style hashmap in Python?’ and the answers are always easy to find.

2 Likes

C# does not support multiple inheritance. Java don’t like pointers. JavaScript is asyncronous by design. Smalltalk devalues the idea of a “program”. Other languages forces you to use their own restricted concept of OOP. Only C++ is tabula rasa.

1 Like

Why someone want to learn C# today :unamused: LOL :yum:, used to use it for many years, several years ago ( when I was young and … ), now I am full on C, C++ for cross platform compatibility, sure, C# is simple to use, and have great debugging tools, but I do not recomend it for long term usage, you will come back to C, C++, For long term usage and cross platform compatibility I recomend you Qt, covers any device and OS from PC to IoT.
And learn pure C for linux and linux resource usage, it will be very usefull for you, install tilde on linux as a CL file editor to be familiar with CL editors and learn to create Makefile files.
Migration between C, C++ and C# is pretty simple ( as typing ), if you learn one you pretty much learn the rest, C and C++ are more close to each other than C, C++ and C#.

:beers:

2 Likes

The only advantage of C# I constantly use is that you can use C# and .NET in PowerShell. And PowerShell and .NET is preinstalled on every Windows OS. So in closed environments (for example banks) where you can’t install software manualy it really helps with scripting and administrative tasks.

2 Likes

Wow, guys, this is really impressive. Everyone has their own opinion about the choice of language to study, now it is even more difficult to choose🤪. I want to clarify: initially, the essence of the question was where to find a good resource for learning C #? Now the question should look like this: which language to choose to start writing games for smartphones? I think the most obvious answer would be C # / C++. After all, these languages are used in the most popular engines (it is important for me that the engine has the maximum number of tutorials and a large community) . I also understand that it is worth studying other languages, since each of them is able to solve a specific problem in each specific case. I hope that over time I will be able to master them, but this requires good motivation. My motivation - games. So for now, I will stick to C # and study C++in parallel. Thank you all for your help😉

2 Likes

Asking questions about programming languages is like asking about religion- you are going to get some strong opinions :laughing:

3 Likes

As long as the language you choose is suitable for the task you have in mind and meets your needs (good tutorials, other people to help you along), it doesn’t really matter which one you learn.

You could even try several and then stick with the one you find easiest.

There’s nothing to stop you learning the others later, and once you’ve become good with one language you’ll find learning the others a lot easier.

(For future reference: you may be better off basing your decisions on data rather than asking for people’s opinions. Most people’s opinions will be skewed by which languages they like and dislike.)

I think that’s sensible. If you need help with either, feel free to ask me since I know both quite well.


In the immortal words of Bjarne Stroustrup:

There are only two kinds of languages:
the ones people complain about and the ones nobody uses.


Because it’s still popular and widely used.

It’s good for game development, back-end server programming, rapid development and GUI development.

Every Arduboy game level editor is (as far as I'm aware) written in C#...

And on Pokitto, @filmote, @Dreamer2345 and I used C# for the Forge level editor for Dark Ritual.

As someone who knows both C# and C++ fairly well, I disagree with that.

You’ll certainly have a head-start, enough that you can probably write some simple programs or quickly pick up enough to write something half decent, but you won’t know immediately know all the ins and outs of the languages.

To give a few examples...

C# won’t prepare you for:

  • Pointers and references
  • Having to do manual memory management
  • Template metaprogramming
  • The things C#'s generics can do that C++'s templates can’t

C++ won’t prepare you for:

  • C#'s struct-class dichotomy
  • Attributes
  • Reflection
  • The things C++'s templates can do that C#'s generics can’t

C won’t prepare you for:

  • Classes
  • Inheritance
  • Virtual Functions
  • Namespaces
  • Design Patterns
  • Generics
  • References
  • Attributes
  • Reflection
  • A lot of other stuff because C is a really bare bones language

I’m going to try to keep my responses short…

It supports a limited form of multiple inheritance through interfaces.
Granted that isn’t ‘true’ multiple inheritance, but frankly ‘true’ multiple inheritance is overrated anyway.

No, but most dynamic languages don’t support pointers either,
and yet, as you say yourself, those languages are still popular and widely used.

Whether you actually need a language with pointer support depends on what you’re doing. Pointers are only really necessary for low-level programming, in most other situations references will suffice.

It supports asynchronous behaviour through the use of library extensions (as do most languages), but that’s not really the same thing as ‘asynchronous by design’.

I can’t comment on that one because I know very little about Smalltalk.

Unfortunately OOP itself is a very loosely defined concept.

There’s no set standard for what constitutes OOP.
There’s nothing saying “it’s not OOP unless there’s multiple inheritance”, or even that “OOP has to have classes”.

I know what tabula rasa means, but I don’t know what you mean by calling C++ ‘a blank slate’.
I can think of several possible meanings, some negative and some positive.

1 Like