DEV Community

loading...

Why C# is (one of) my favorite language?

giovannicodes profile image Giovanni Cortés Originally published at giovanni.codes Updated on ・2 min read

My first approach with C# was when I was studying my career; a guy from Microsoft came to my school to do a chat about C# technologies and one of them was Windows Phone. So I started to learn C# and create Windows Phone apps (I won a Nokia for that :) ).

After one year, I started to create C# videos on YouTube and was a popular channel in its time, now is abandoned, but I received very good comments about that course in YouTube, even of teachers that send their students to watch that videos.

For some reasons, when I started my life as a professional developer I left C# and started to write apps for iOS, Python, Elixir, etc. But sometimes I had to write C# code for fixing some apps or for a job but just for 1 or 2 months. Whenever I got back to C# I feel very comfortable with the language, is like to return home. Now, that I'm doing a tutorial of MonoGame I am using C# again and I am enjoying it.

Today, I want to write why C# is one of my favorite languages and why I think that is a great language to work with

Is easy to learn

Despite Python is the option to learn as the first language, I think that C# is better to understand the "low level" programming without the complexity of C or C++.

Learn C# is not as complicated as other thinks, and because is very influenced by C and C++, once that you learned, you can change to another language very easy (I am able to read C++ code without even touched).

It is in a line between the old and the modern

When you write C#, you have to deal with "old" for style or creating arrays with a fixed length. But you can create lambdas expressions, you have access to foreach to go through a list, the string manipulation is very powerful etc.

With C# you have the option to be traditional or write code with the more advanced features.

Is very versatile

In recent years, C# has become in an all-terrain language. You can write Windows Apps, iOS apps, Android, IoT, web sites, run in Arduino, even run in Linux.

You can write games with Unity, MonoGame, Xenco and use it with Machine Learning.

Thanks to its open source we can expect a lot of implementations, and if you learn C# you can use almost as you only language (I do not recommend this but is possible)

Microsoft Documentation

I think that there is no better documentation than Microsoft Developer Site. Other pages like Apple Developer or Django are close but I feel that is not as extensive or comprehensive as Microsoft Docs.

I learned a lot (and I still doing) only reading the Microsoft site and I found that my problem was resolved without touch StackOverflow.

It is not Java

Ok, this is not a valid reason(?)

Well, that is a list of why C# is a language that I think deserve more love of the community.

Do you like or dislike C#?

Discussion (17)

Collapse
turnerj profile image
James Turner

I love C#, it is my favourite language. I actually do like the coding conventions in C#, editing code in Visual Studio is great and .NET Core is fast!

If I had to be picky about what I don't like with it, it is probably the query syntax for LINQ.

For example, I don't like this (query syntax):

var numQuery =
    from num in numbers
    where (num % 2) == 0
    select num;

I prefer this (method syntax):

var numQuery = numbers.Where(num => num % 2 == 0);
Collapse
saint4eva profile image
saint4eva

I love method syntax better.

Collapse
frothandjava profile image
Scot McSweeney-Roberts

It's not the language that bothers me (it's basically a Java dialect with real generics). It's the idioms - IInterfaces, the start brackets in the wrong place, the casing choices, namespaces that cause a pointless indentation, the lack of a common structure to projects and the build system is an archaic mess. I guess the last two are less of an issue if you're using Visual Studio, but that's another problem that is only slowly resolving - the over-reliance on a single IDE.

Collapse
saint4eva profile image
saint4eva

Have you tried .Net Core? Give C# 7 or 8 a try. And the build system has been drastically improved. One good thing about C# is that the language keeps improving and evolving. Notwithstanding, I respect your opinion.

Collapse
frothandjava profile image
Scot McSweeney-Roberts

The build system is better than it was. However (and I admit that this could be more my greater familiarity with maven than anything else) there have been times when I've been using dotnet core and wishing I could use maven instead of msbuild+nuget.

Speaking of dotnet core, here's another problem I see (as someone who plays with F# but is otherwise an outsider) - mixed messaging from Microsoft. For example, there's a big song and dance about cross platform but now they're going on about Windows Forms and WPF with v3. That's not very cross platform. It would be one thing if it was clearly defined as something that sits on top of dotnet core and not a part of dotnet core. Maybe it is, but it's hard to tell, at least from what I've heard from Microsoft.

Which also reminds me of another problem I see - practically all the evangelism (at least from Microsoft) seems to be geared towards getting people to not leave. Very little effort seems to be being put into getting people to turn up. Which is kind of sad as I think .net is the "fullest stack" available and a lot of people could benefit from getting into it.

Thread Thread
saint4eva profile image
saint4eva

There are other open source community-driven alternative to MS Build - you can use Cake, Fake or Nuke. They are even simpler to use and yet powerful.

Regarding the dotnet core 3.0 support for WPF and WinForms, it has nothing to do with cross-platform. It just that those desktop technology will take advantage of some of the strengths of dotnet core such as performance, speed, signle deployment model and side-by-side deploy. I think Microsoft specifically gave an indepth explanation about this. So asp.net core and dotnet core are cross-platform.

I think this cuts across all the stack, to be hoest. In some countries - even in some county or states - some people love Java more .NET, while in some other countries some people love .NET more than Java. I think the reason Microsoft open sourced .NET was because many companies would love to use .NET but it was not open source. Now it is open sourced by Microsoft and many people are contributing, many people have started using it also. But your statement little "little effort", could you elaborate on that? Note Samsung is adopting .NET, Google etc. By the way, C# is still one of the most popular and loved programming languages.

Thread Thread
frothandjava profile image
Scot McSweeney-Roberts

it has nothing to do with cross-platform

That's the problem. In previous versions Microsoft constantly patted themselves on the back about how cross platform dotnet core was. Now they may or may not be doing an about face on that and you have to start to wonder how committed they really are to being platform agnostic.

Microsoft doesn't need to give an in-depth explanation. All they need is some basic product differentiation. Call it something like "The Modern Development Framework For Windows" and only mention dotnet core in passing, as opposed to the "Windows development is coming to dotnet core" messaging that they've been doing. They could even go one better and blow the dust off some of Mono's Linux-y bits (like GTK support) and port that to dotnet core as the "Modern Development Framework for Linux". OK, maybe not call it "Modern" because of the UI connotations and the Windows and Linux specific products should have fairly different names to avoid confusion, but hopefully you'll see my point that the platform specific code should be highlighted as not being the same thing as the platform agnostic core product.

As for "little effort" - watch any .net related video on YouTube with an evangelist from Microsoft and there's little effort put into why someone who isn't already using .net would want to start using it. If anything, the emphasis is put on why you shouldn't leave. It's always "you don't need to learn JavaScript" or "you don't need to learn Swift and the native iOS platform". There's practically never anything on why someone with a JavaScript or iOS or Java or whatever background should want to come over to dotnet.

In some ways the mixed messaging over Windows development in dotnet core is also part of the low effort to attract outsiders. It might make perfect sense to people who are already on the platform, but if you were evaluating the platform cold it looks like there's no clear direction of where it's headed and when you combine that with Microsoft's mercurial track record it really doesn't look good.

C# might still be popular and loved, but from the outside looking in it looks really, really insular.

Thread Thread
saint4eva profile image
saint4eva

You have already said you are a Java developer. So I rest my case.

Collapse
cout970 profile image
cout970

I dislike C# not because is bad, it's pretty good compared with other languages, but I hate the Microsoft coding conventions, especially functions and methods starting with uppercase characters. I tried several times to start projects in C# but for me it's really hard understand the code, even when I'm used to program in other of languages with worst readability (looking at you java).

Also the lack of support for hotswapping code at runtime makes the coding experience less enjoyable.

Collapse
giovannicodes profile image
Giovanni Cortés Author

I agree that Microsoft has a weird code convention, especially in C++ (the Hungarian notation is not for modern times) but, once you get used to that format, is not so bad.

Collapse
jonathanhiggs profile image
Jonathan Higgs

I think the worst convention is sticking Exception at the end. InvalidArgument has everything you need in the name without extending it to InvalidArgumentException, it is just extra characters that take up space

Thread Thread
giovannicodes profile image
Giovanni Cortés Author

Sometimes C# is very verbose, but not at the level of Java

Collapse
lmolivera profile image
Lucas Olivera

I learnt C# because my job demands it and I have to say I would have prefered to meet .NET with it instead of Basic. It is a powerful language I feel.

Collapse
jorgecc profile image
Jorge Castro • Edited

I ❤️ Visual Studio
And Visual Studio loves me.

Collapse
giovannicodes profile image
Collapse
saint4eva profile image
saint4eva

I love C#. It is an OOP language with excellent Functional language qualities. And I love it multi purpose nature and excellent tooling it provides.

Collapse
alichraghi profile image
Mohammad Ali Chraghi

i only love c# syntax

Forem Open with the Forem app