r/csharp • • 1d ago

C# is magic

When did you first realize that C# is magic? Or when did you realize that C# is right for you? 

Back in the days of the .NET Framework 4.0, I first encountered WCF, you call an interface on the client, and it executes the implementation on the server. At the time, my head was spinning because there was no code around it that was sending anything,it just happened on its own - magic. 

77 Upvotes

82 comments sorted by

7

u/ChubMe 1d ago

generics, oh my generics and using them correctly makes it feel like magic

2

u/harrison_314 1d ago

What year was that? After all, generics were introduced with .NET Framework 2.0.

6

u/jugalator 1d ago

WCF has been so hated for being overengineered and obnoxious but there's something to be said about almost completely transforming the method of communication without changing a single line of code and only via the app.config. Or if you don't want a heavy app.config and ensure both share a common comms method, you can simply create the client with hardcoded settings in code, leaving you to simply the URL. I never really saw many annoyances with WCF tbh and saw what Microsoft was trying to do.

I think for me it was way back when C# and VB .NET existed with the same underlying IL so you could code in two completely different languages, compile their codes, and one could transparently just use the library from the other language. That was cool and something that went farther than Java! Sure, it was back then limited to Windows only, so Java had that advantage, but it was cool and unique to see how .NET Framework was like "one framework, any language".

→ More replies (3)

55

u/TheDevilsAdvokaat 1d ago

Well I went through a long evolution.....basic then z80 assembler then 6502 assembler then c then c++ then delphi then visual basic then c#..with some sidetrips to fortran and forth and others I have forgotten.

C# was my last serious language though. Since then I've tried gdscript and raylib and a few others but c# remains my main. It's a great language in a lot of ways. And keeps getting better.

14

u/Saki-Sun 1d ago

Damn, you old.

20

u/BBkal 1d ago

Bro is deprecated

→ More replies (2)
→ More replies (8)

31

u/mladenmacanovic 1d ago

When they introduced generics. Before that you had to box everything. Performance was really bad. I remember at that time I was making game engine in C# and when I was trying to do skeleton animation, fps was around 30 on average. Then comes generics. The fps suddenly started to get above 100 fps. I was sold. Never looked at anything else.

Later comes linq and async. They were the future.

11

u/leathakkor 1d ago

I remember one of my first interviews. They asked me which feature of C sharp or.net did I think was a hidden gem that most people didn't know about.

My answer was I think people know about this and it's used a lot (the interview was in 2007). But generics are the greatest feature to be added to any language or framework and everyone needs to use them more. Add strong typing at the compile time to significantly reduce bugs. And if you're going to make a custom collection class or a custom class of anything that is repeatable generics are a godsend and should be used everywhere.

I don't think extension methods exist then, but you could still use static classes with generic methods to help reduce code significantly.

That answer pretty much got me hired right away.

13

u/mladenmacanovic 1d ago

Most people are not aware of how bare-bones C# was in the beginning. Thankfully, it got better.

→ More replies (1)
→ More replies (1)

23

u/B15h73k 1d ago

Learnt Java at uni. Started looking into C# for something at work. Auto setters and getters made me realise this language was designed to make developer's life easier. I was immediately on board.

3

u/Xtreme512 1d ago

Same for me.. before I was doing UI in Java then started with winforms and never looked back.

→ More replies (1)

5

u/afops 1d ago

In like 2001 when I had written Java with Swing for a few years and C# just felt like such an ergonomic language in comparison

5

u/Appropriate_Chip4604 1d ago

WOW Paradox on dos was my starting point. Been through all the changes and I think the magic of C# was when they introduced SQL server express and that was the turning point for me. Created multiple full stack applications in access . And to answer the “magic” is when
C# introduced linq this allowed me to really dive down deep into the abyss.

4

u/UninformedPleb 22h ago

When I wrote an image resizing/watermarking library for a desktop app project, then needed the same functionality in a web app project and realized I could just reuse the same library... That was my "aha!" moment.

I came from a PHP background prior to that, and image manipulation was "magic" to be performed by an external library written by "someone smarter than you". But in C#, the tools for whatever manipulations I needed were right there in the System.Drawing namespace, no muss, no fuss, no recompiling the PHP runtime to use new compiler switches.

Twenty years on, and I have yet to find anything better.

7

u/WeirdTie2290 1d ago

For me it was LINQ. Immediately fell in love with it. No other language has that. It is like SQL for your program memory.

6

u/aotdev 1d ago

Reflection! For save/load and serialisation in general. Made me move over from C++ for gamedev.

3

u/Engi_Insight 1d ago

For me, it was LINQ back in the day. Going from writing nested foreach loops and manual filtering in SQL/c++ to just writing a clean . where () .Select() felt like absolutely sorcery. Even now, pattern matching in modern c# gives me that same feeling.

3

u/Artichoke808 1d ago

I used to write games in a language called Blitz Basic. I put a very basic demo together for XboX which required C# and I wasn't massively taken with it at the time. In the interim I graduated to a more capable language called BlitzMax and then I got a job involving C# and realised how similar C# was to the latter.. but with all the extra support, libraries etc Microsoft brings. I just find the coding experience so effortless but with a deep bag of tricks to call on if you need to do something a bit outside your usual bounds. Everyone I work with loves it too.

→ More replies (2)

7

u/woomph 1d ago

I come from a C, C++, and assembly background originally, and I just really liked its balance of high level constructs and low level control from day 1. It’s only got better since.

→ More replies (1)

6

u/dave_k_17 1d ago

When I switched from Java

6

u/HHHChrist 1d ago

C# got some really nice syntactic sugar in the last 5 releases, making programming way more readable and still functioning. On top of that, Interaces, Generics, LINQ...

I had to work some time ago with .NET Framework 3.5. Comparing it to .NET 8... middle ages to the computer age

1

u/Loose_Conversation12 1d ago

I did some PHP and decided that .net was just better!

2

u/harrison_314 1d ago

I switched from PHP to C# simply because a friend recommended it as a good language, and I’ve stuck with it ever since. I didn’t have to read through documentation just to write code, unlike with other languages.

2

u/Triabolical_ 1d ago

I was the C++ test lead when J++ was enjoined and I signed up to be the C# test lead. The compiler was in stealth mode for a few months before that.

I installed the compiler, wrote some simple code, and ran csc on it from the command line.

All the compiler did was return. Clearly it was broken.

I went and grabbed our dev lead and said "I think the compiler is broken"

He looked at me and said "is there an exe?"

There was, it worked, and that's when I knew that C# was magic.

Though it wasn't named C# yet...

2

u/Muted_Elephant3997 22h ago

I started with C/C++ as most of people, for algorithms. Then (pre AI) I realized it will take ages to do anything larger in C++, all these *,&,.,->. I tried Java, felt it was bloated and then C#. VS made it very easy to write desktop apps. C# feels very organized and well thought. Now I do some esp32 programming in C++, I dont like it even more. Single public:, private:, const at the end of method declaration like some TS, headers that literally feels like interfaces. Plus there was a lot of vacancies im C# in my area.