DEV Community

The C# Language

Riley Van Ess on September 02, 2018

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

Collapse
 
jamesmh profile image
James Hickey

Both for me - I love it.

Especially in the past couple of years with the point releases (i.e. faster smaller releases with new features etc.)

C# has been bringing in new features that are OOP oriented and "functional programming" oriented - which is exactly what they have said they are trying to do. C# version 8 is bringing in some new features that are very cool - like switch expressions.

I use C# mostly in a web context at work. For personal project's I'm 100% using .Net core. In both contexts I'm using version 7.1 +.

For example, I have an open source project (written in C#) that helps developers build .Net Core apps faster with an expressive / terse syntax. I love the flexibility of being able to use OOP where it works best, or FP where it works best. Combining the two many times gives the ability to do really cool stuff.

I'd be interested to know what context those who don't like C# are actively using it in? (i.e. what version, in a web context? etc.)

Collapse
 
tux0r profile image
tux0r

Solely for business. For personal use, it is too big for me, not far from Java.

Collapse
 
rileyvaness profile image
Riley Van Ess

What do you like for personal use?

Collapse
 
tux0r profile image
tux0r

My currently and/or last active projects are written in C, C++, Racket and cough C#. But only because I already started with it and I want to complete the damn thing, I swear. Other than that, the number of languages I have used at a certain point in time is growing. My current favorites are:

  • C (obviously).
  • Common Lisp (gradually moving to Racket though).
  • Delphi.
Thread Thread
 
jamesmh profile image
James Hickey

C# .Net Framework or C# using .Net Core?

.Net Core is so much simpler and easier to use. You can build your stuff using linux if that's preferable?

Thread Thread
 
tux0r profile image
tux0r

No, it's not - it's really, really not. :-) Currently, I'm exploring both frameworks at work.

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
 
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#.

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
 
ahmadmoussawi profile image
Ahmad Moussawi

I use it for business and financial web applications (netcore version), and deploying it on linux with SqlServer and PostgreSql as databases.

It's a very beautiful and elegant language from my perspective, but it lacks the "install and run" frameworks comparing to other languages (rails, django and Laravel) still finding myself spending too much time configuring staff to start a web application.

It needs some time to get the real open source taste,

I've developed my own Database Query Builder github.com/sqlkata/querybuilder, I've found that it has some really awesome features like, method extensions, null operator, async, etc ...

What I hate about it, is the time I've spent on build, other than that I love it.

For my personal projects I use PHP.

Collapse
 
adampb profile image
Adam Piechocki-Brown

I was quite resistant to C# when it first arrived. I didn't want another C-something-or-other language, I was quite happy with C++ and I didn't want another proprietary language tied to MS. About 8-9 years ago I started to use it quite a bit for work. Now it's where I do 99% of my work coding and about 70% of my personal projects.

Its biggest problem for me is also one of its main assets: it is a beast.

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
 
jonathanhiggs profile image
Jonathan Higgs

I work with python, c++, c# (and occasionally java) and c# is my favorite by far so I end up using it exclusively for side projects. As a language it feels like it has a precision (in an expressive sense) that you don't get from python, and while it doesn't have the uber powerful templating of c++ you can get a very long way with generics and the mixture of OO and functional while not needing to think like a compiler along the way. Mix in with that a great IDE and all the extensions for that, package management, build tools, all of which don't over complicate the process, leads to a great general-purpose language that is a joy to work with

.Net Core is a (long-overdue) step in the right direction, and the missing piece needed for sharing the same code between the typical windows client and linux server setup in my industry. The only thing that is still a sticking point for me is that we tend to have a lots of large legacy codebases that are c++ specifically for performance reasons. While c# is never going to compete for that crown, interop that is a bit nicer than the generated binding or writing your own c++/clr would only make the both of them more useful

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
 
0xyasser profile image
Yasser A

I do use it for business only .. and I don't like it.

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
 
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
 
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
 
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
 
jamesmh profile image
James Hickey

I would agree - it's not a functional language in the strict sense. But it is straightforward to use currying, higher-order functions etc. Missing algebraic types... but o well

 
jamesmh profile image
James Hickey

lol Are you integrating the two using net standard by any chance?

Collapse
 
rileyvaness profile image
Riley Van Ess

I was actually just looking in to TypeScript. You use it often?

Collapse
 
ronaldoperes profile image
Ronaldo Peres

I use for both,

But when i am studying i try other languages.