Continuing the series! Feel welcome to dip in and weigh in on a past question.
Let's say I've never used C# (C Sharp) before. Can anyone give the run down of what the language does and why you prefer it? Feel free to touch on drawbacks as well.
Continuing the series! Feel welcome to dip in and weigh in on a past question.
Let's say I've never used C# (C Sharp) before. Can anyone give the run down of what the language does and why you prefer it? Feel free to touch on drawbacks as well.
For further actions, you may consider blocking this person and/or reporting abuse
Gurigraphics -
mohamed Tayel -
Syakir -
Leandro Veiga -
Top comments (25)
Today is, God willing, my last day at my last C# job.
C#'s defining feature is that it has no defining feature. It is truly whatever you want it to be.
C#'s overarching philosophy is basically that there's no such thing as a bad feature, and if that sounds like something you'd like, enjoy! C# will absolutely not stand in your way. For my part, I work well under constraints, and I appreciate when a language nudges a user towards best practices (especially since, you know, I have coworkers...)
The other thing I'll say for C# is that for all that the NuGet package manager leaves something to be desired, the package ecosystem is enormous. That corporate money does its thing.
Nicely put.
Personally, I too find that such an overload of features is not a good thing, that is why I recommend students to learn Java before anything else. A stricter environment to learn basics can be adopted to flexible life, not the other way around.
But it is this philosophy that has made C# a truly universal language. Web, All desktop platforms, all mobile platform. Unity, Godot, Game development. Blazor for webassembly. Micro-controllers, You name it, you will get C# on it.
I have to give you game engines--I'm not in that space but I'm aware C# is big in it--but for the rest I'm skeptical that C# is more per-se universal than anything else. Seems like these days pretty much everything has a native compiler, a WASM compiler, and a JVM compiler. Like, I could write pretty much the same paragraph about the universality of, say, LISP, which has the smallest list of language features I'm aware of.
Yes. there is a native compiler for everything. Game engines have C++, Godot have GDScript. Rust is getting popular with wasm. But there is a C# solution available, for those who want it. Mobile apps, with Xamerin, Front-end with razor and blazor, Desktop apps with multiple gui toolkit support, There is an SDK for microboards like arduino too. Microsoft is not trying to make C# be the best solution in all the field, but trying to be "An Acceptable Solution" to all field.
And reason why these fields support C# as a native solution, because this way, developers wouldn't need to learn it from scratch. C# compiler doesn't compile it to CRL/IL in all cases, It can be configured to produce native binaries, or a portable executable library file. This is why it is easier for anyone to provide first party support to C# in their field.
In the end, a C# developer can write code for any of supported field, without need to learn a new native stack. And if you are creating something new, and want to attract developers quickly, providing support for C# might be fastest way for you.
It may come with tradeoff, Mobile apps in C# are really slow, But for some, hiring and training cost may just be high enough that they would be willing to accept tradeoffs.
I'm not denying that C# is cross-platform, and I do understand the benefits of not having to learn a new language for every stack-- I just don't see that as being any thing specific to C# or C#'s philosophy.
We've tried GoLang for 3 different projects and had to scrap it every time due to a missing eco system, and difficulties finding (stable) libraries ... :/
C# is a versatile language that was created by Anders Hejlsberg who works for Microsoft. Microsoft also own popular tools like Visual Studio Code and GitHub. This is a very powerful open source combination that integrates and works well together.
Anders Hejlsberg also created TypeScript so if you are a JavaScript developer then learning C# should not be too challenging because they share some similarities. The C# programming language has many use cases you can create web, desktop, mobile and server applications much like any other programming language.
One of its biggest advantages can be seen in the area of game development. The game development engine Unity uses the language C# and it is incredibly popular because a lot of big gaming companies use it for building AAA titles for consoles and PC's. Unity can also be used for developing mobile games too. The C# programming language is fairly modern and is Microsofts competitor to Java.
With all of these features and advantages C# is a very powerful language to learn which does not have an extremely challenging learning curve when compared to other general-purpose programming languages like C++.
For me there are a few things that stand out in C#.
LINQ - Language integrated query. some other languages have tried to incorporate parts of this, but what you can do with LINQ in either a fluent syntax or the SQL-esque LINQ syntax is pretty incredible. Complex data operations on multiple data sources are the easiest to write that I've seen in any language.
Task Parallel Library (TPL) - This makes building multithreaded apps much easier to write and works with async / await patterns OR using task continuations. Both of these patterns will look similar to what Javascript does.
Generics and Delegates - the starting points for more functional styles of programming in an OOP language.
C# is mature and feature rich. There is a way to do anything you can think of.
NuGet - LARGE ecosystem of libraries to speed development.
Events - built upon Delegates and allows for simple Pub/Sub patterns to be built up between code modules. Code is easier to decouple as a result.
Extensive documentation - everything from the basics of variable assignment to the extensive tutorials on building certain kinds of apps is centralized on the Microsoft language documentation. One place to look.
Direct interop with F# - write some libraries in a functional language, consume them in an OOP language, no big deal. Do it the other way, no big deal. It all compiles down to "Intermediate language" and runs on the same runtime. (This also works with VB.NET, but just don't. VB is on sunset status)
AND some drawbacks:
C# is mature and feature rich. This is slated as a good thing also, but when there are 9 different ways to do anything, you see a lot of different patterns in the wild that accomplish the same thing. Thus, no "idiomatic" C# like we're currently seeing in Go.
NuGet is huge and there is a package for everything, but you have to be really careful about licenses when using anything. Some of the biggest players in the ecosystem and strictly for-profit are write libraries that they expect you to pay for. Fine for enterprise, but not for someone starting out.
Extensive documentation - sometimes it's just too much. Like sipping from a fire hose.
I would go further and claim that a language with restrictions does not mean it provides the ability to write good code or best practices.
However there is definitely value in having standards in how things are approached. To me this is less about the language and more about the collaboration. How is code shared, what can be done in code refactors to provide upgrade paths. Does the team work to stay up-to-date or put things on life support.
This is a good pitch
Why I Chose C#
Chadwin Deysel ・ Apr 23 '22
Do you want to build an app? You can build your app using any OS, or just a web browser. Your app can run anywhere that apps, or code runs. You have the option to use best-in-class tooling (even from your web browser) and choose from millions of libraries inlcuding one of the FASTEST web frameworks on the planet. The question isn't why would you choose C#, but why wouldn't you?
Some may disagree, but I believe C# is the easiest strongly-typed compiled language to learn if you already know JavaScript. Most of the time it even feels like JavaScript. It lends itself well to a paradigm of imperative code with functional features, chained operators, and plenty of generics. It's also really concise but manages to tell a story most developers can read, even without prior C# experience.
It's fast, has an endless lineup of features, and enjoys extremely high-quality support from Microsoft.
And LINQ is the best functional list extension library on the planet. It makes me happy every time I use it.
Most packages implemented by Microsoft. Centralized technical leadership leads to a mixed bag of nice and mediocre ideas for frameworks, rather than typical decentralized oss in python, ruby, node where the best frameworks and libraries end up winning.
Moves slower, less churn than node, which can be a pro or con.
I believe C# has led the way and inspired many other languages by showing what worked and didn't work. I'm thinking of attributes, generic types, and especially async/await.
The language is awesome and they are still innovating a lot, although this also means some older features have become irrelevant because new features do the same much better.
C# is similar to Java from a point that if you learn C#, skills related to code structure that you will learn will form the basis of your entire developer life.
Sometimes I feel that there are just an overload of language features creating a confusion on what technique to use. Where one thing can be done with many techniques, All techniques are valid and have different tradeoffs. Microsoft is known for that. Typescript is also an overload of features.
At present, Biggest benefit of learning C# is that it is a truly universal language. Dotnet Core is available for mac, windows, linux. You can create mobile apps with C# using xamrin libraries. Blazor webassembly has a good DX if your stack is already dotnet based. For game development, Unity, Unreal, Godot, And many more, allows you to use C#. Some home-automation system are also programmable with C#. If I remember correctly, Arduino board was also planning to implement C# sdk.