DEV Community

Riley Van Ess
Riley Van Ess

Posted on

The C# Language

How many of you on here program in C#? Do you use it for business or personal use? Do you like it?

Latest comments (24)

Collapse
 
bradwellsb profile image
Bradley Wells

Both for me. It's very versatile. Using C#, I can develop applications for desktop, web, and mobile. C# and .NET Core for cross-platform work. C# and ASP.NET (MVC, Razor pages, Blazor) for web. C# and Xamarin for native iOS/Android. I haven't dabbled in it yet, but you can even use C# with Unity for game development. What's not to like? :)

Collapse
 
ronaldoperes profile image
Ronaldo Peres

I use for both,

But when i am studying i try other languages.

Collapse
 
justinjstark profile image
Justin J Stark • Edited

I use C# primarily for business. It is a very good OOP language that is continually updated with new language features that make it better and better. C# is very popular in enterprise so there are tons of jobs available. The tooling around it is expansive; you can find open source and free tools for pretty much anything you want to do.

That said, my biggest gripe with C# and the ecosystem is it is anything but a pit-of-success. Most of the templates and advice new programmers are given (example: scaffolding) will get you up and running quickly but will invariably lead to messy situations of object reuse and tight coupling. You have to learn things the hard way like "every view should have its own view model in MVC" and "every integration should have its own DTOs". These run against the standard advice of DRY but they are very necessary. Otherwise you wind up with object-dependency-hell where a change in one part of your application blows up an unrelated part. To solve it, you wind up with tons of object and tons of plumbing/mapping code.

Null references are still one of the biggest causes of bugs in C#. There is finally a feature being worked on to make objects non-nullable but who knows when that feature will finally get introduced. And it's not going to be enabled for new variable declarations by default.

In order to accommodate the tools and language shortcomings you will use class properties everywhere. Unless you are very thorough and ensure all object creation is done through object constructors while encapsulating your properties, good luck ensuring your objects are all in valid states as your application changes through the years. Good DDD patterns with layers and encapsulation help, but again, it takes a ton of code and knowledge to pull off.

I wish C# had more compile-time checking. I wish I could use Clojure-style maps as function arguments with compile-time checking instead of having to define a query object (DTO) and a result object (DTO) for every consumable function working with complex data.

New programmers will write "services" that do a bunch of things when they'd be better off writing static functions or single-function-classes. Writing testable code in C# is way harder and requires a lot more code than some other languages. Dependency injection helps but the wiring is tiresome so then you have to learn IoC. Fine, but how much better off would you be had the language templates started you here.

These are just a few of the issues that are on my mind right now. The amount of knowledge you need to have and the amount of code you have to write in C# to create maintainable enterprise applications is mind-boggling. So many applications, especially those in enterprise, suffer from premature rot because the language pushes you toward writing code that is fast (cheap) but will haunt you for the lifetime of the application. A lot of newer languages have sprung up because of these exact language issues that aim to guide programmers to successful strategies from the start.

Collapse
 
alanmbarr profile image
Alan Barr

It's overall pretty good but I do get frustrated with some of the details of either the libraries or implementation of windows stack stuff. HttpClient and using statements, ServicePointManager default limit of 2 http connections unless you override it, the task async/await library is not easy or clear to use without causing unintended consequences. Opaqueness of debugging wcf errors. F# is pretty awesome wish C# wasn't so great so it could get traction ;)

Collapse
 
goaty92 profile image
goaty92

C# is an excellent language. I use it both for personal and academic work. It is like Java that doesn't suck. It allows you to be performant when you need it, and functional/maintainable when you want it. .Net core opens up a lot of possibilities for C# to be used on different platforms. Best features in my opinion(and there are many more):

  • Value types enable really efficient code.
  • async/await makes concurrency much easier.
  • string interpolation and pattern matching.
  • Functional programming (Linq and expressions).
  • Interop with other .net languages (F#).
  • Span<T> and stackalloc

My current C# project is a data serialization library github.com/dhhoang/IonDotnet and is welcoming contribution. Pls send me PR/issue 🤗 if you're interested.

Collapse
 
twigman08 profile image
Chad Smith

I use C# for both.

I started using C# at work and after getting to know the language more I started to enjoy it more. Now it has been the language I enjoy doing my personal stuff in also.

I think it is a great language. It also just fits the type of languages that I enjoy. I'm just not a fan of languages where you just throw anything at it and it tries to figure out what you meant.

Collapse
 
jfrankcarr profile image
Frank Carr

I do, mainly for work and a few personal desktop projects. I've been working with it for about 14 years now. I've written Winforms, WPF, ASP.NET, MVC and Web API applications with it.

The main thing that I like about it is that most language elements are well thought out and its easy to implement OOP patterns, testing, database access and other stuff. LINQ and generics are also very useful.

For personal web projects, I've mainly used PHP since shared hosting is usually LAMP based. I find that I miss some of the elements of C# when I have to do this.

Collapse
 
drewknab profile image
Drew Knab

I use it at work now building websites and have used it in the past for desktop apps. I also briefly used it with Unity and fell off the wagon when I started my current job.

It's a pretty solid tool but I'm not particularly in love it.

As for the associated toolchain:

Yeoman and Nuget are fine.
MVC Framework is as good as any other language specific MVC framework.
LINQ is interesting and a pleasure to write code with.

I've been hemming and hawing at trying out .NET Core to build some APIs.

Collapse
 
liamwright profile image
Liam Wright

I use it for both business, and personal use. From the comments below, I don't understand the hate for it. But C# is my main language, and I haven't dived into C++, so I don't know the difference.

Maybe someone can explain why they don't like it?

Collapse
 
drewknab profile image
Drew Knab

tux0r is a unique case in that he maintains a blog app in C++ for fun. :p

I don't hate the language, it's good. It's an absolute workhorse that can do pretty much anything you throw at it.

Comes down to a couple of things for most people:

Huge standard libraries
Near Java verbosity

Collapse
 
danieljsummers profile image
Daniel J. Summers

I'm a fan. I've used it in both business and personal settings, and were it not for F#, I'd still likely have active personal projects that use it. They've made some nice improvements to it over the past 5 years or so -- an easier async programming model, and the ability to write in a more functional style.

Even if you eventually choose a different language, if you're going to be targeting .NET Framework or .NET Core, it's at least worth learning to read. Microsoft is getting better about including C#/VB.NET/F# examples in their docs, but there will always be a C# example. There is also a lot of information in the community that applies to the ecosystem, but the example on how to consume it is usually in C#.