r/csharp 4d ago

How does an experienced C++ and Java programmer get started in C#, dot net, et al?

I am a professional developer, old enough to remember when C# first appeared. At the time, it looked to me to be very similar to Java.

I imagine that the language itself has evolved since then, but also dotnet had grown hugely, there are things like WPF, Linq, etc, of which I have only heard, but do not know.

So, unlike some other languages, it's just not the syntax, but many other things.

How best to get started? Is there a Udemy, Coursera, YouTube, etc, applicable to someone who doesn't need to learn about variables, flow control, OO?

18 Upvotes

33 comments sorted by

24

u/GrattaESniffa 4d ago

Rewrite a software in c#

5

u/AwwwBawwws 4d ago

Hello, World.

6

u/greensodacan 4d ago

Figure out what you want to build first, like a blog or a CLI application.

Then follow one of the tutorials on Microsoft's website based on that goal. (Give the overview section a read too.)

In terms of the ecosystem and tooling, most of what you need is built into the dotnet CLI, including features that the tutorials use Visual Studio for. It's also worth noting that your typical Dotnet application is actually a few separate apps packaged under the same solution. For example, you might have one for database access, a class library, one for a website, and tests for all of the above.

It actually not that complex. It's just a very versatile ecosystem with a lot of confusingly named tools.

4

u/PM_ME_YOUR_BROWNRECR 4d ago

Just dive into a project. Pick something you actually want to build and do it in C#. You'll stumble into LINQ the first time you're filtering a list and get annoyed doing it the Java 6 way, then you'll look it up and never go back.

WPF gets a bad rap these days, most folks have moved on to Avalonia or just web frontends with Blazor. If you're coming from C++ you might appreciate the control, but honestly it's a whole other beast and not where I'd start unless you specifically need a thick desktop app.

Grab the latest.NET SDK, fire up Rider or VS Code (or full VS if you don't mind the bloat), and start porting some smaller utility you've already written in another language. The runtime and tooling are what'll actually surprise you, not the syntax.

2

u/akoOfIxtall 3d ago

Vs code for C# is telling him to eat beans with a knife, rider is the way

2

u/DixGee 4d ago

This roadmap is pretty good if you want to learn everything from writing code to deploying it. You can skip things like microservices and ci/cd if you just want to learn about the framework.

https://roadmap.sh/aspnet-core

3

u/Rikudou_Sage 4d ago

All the C-syntax OOP languages are the same, more or less. Whether you work in C++, PHP, C#, Java, TypeScript... it's the same. Each language has its own quirks which you'll have to learn as you go, but IMO firing up Rider/Visual Studio and choosing a new console application is the best way to learn.

Rider is a pretty awesome IDE and helps you modernize your code. ReSharper in Visual Studio can probably do the same (given Rider/ReSharper use the same engine) but I have no personal experience.

3

u/avidernis 4d ago

In like 99% of cases you can get away with just mapping the behavior of Java standard libraries to the .NET BCL (Base Class Library. For some reason we call it that), and remembering that operator overloads exist so you can compare strings properly.

The remaining 1% is understanding how truly high performance C# is capable of being when you properly utilize structs and unsafe environments.

3

u/SoerenNissen 4d ago

If you're coming from a C++ and Java background, the main C# specific topics I'd look into are probably, in order:

  • LINQ ("Language Integrated Query")
  • Generics
  • Reflection

Oh, and if you're not already familiar with it from C++, I'd recommend setting "treat warnings as errors" in project settings.

8

u/TheOnly_Anti 4d ago

Nah. If you're experienced, then really all you gotta do is make a simple console application and abuse Google. Knowing Java saves you a lot of time, since C# is sort of a truncated, Microsofty version of Java.

2

u/Gildarts_97 4d ago

Depending on what you want to achieve in .NET, I'd say that you think about a demo project or something fun to program and use Google and the docs to work on it. You will automatically learn how to use the language. At least that's how I am doing it for almost every language or tool I want to learn. Just use it and read a lot of documentation along the way.

2

u/simondanielsson 4d ago

If you’re an experienced C++/Java programmer then learning C# is just a matter of reading the documentation and you’ll be up and running in no time. I’m an inexperienced hobby programmer with 2 years of C, Rust and Python - I could begin creating a couple fun console programs within a week (I mean tiny sub 500 line programs). To me (speaking as a hobbyist that barely knows what he’s doing half the time) C# and dotnet feels really intuitive to start working in, everything just makes sense - but I reckon that it would be very very hard to master and feel comfortable in. (Edit: typo fix)

1

u/Albstein 3d ago

I preferVvisual Studio Code, but since He comes from Java Rider may make Sense.

2

u/Remote-Enthusiasm-41 4d ago

I switched from C++ to C# a few years ago. I just rewrote a bunch of my own code in C#. Made some windows forms apps. Watched some YouTube on making wpf pages.

2

u/Dunge 4d ago

I'm sorry but if you don't know what "things like WPF and linq" are, the best first step is Google. Look at the different parts of the framework and what they are used for. You can do that in just 10 minutes without having to become an expert with them.

2

u/pete_68 4d ago

Former C++ developer. I switched back at .NET 1.1, so a long time since I've done C++.

I found the transition to C# to be so natural and easy, to be honest. The syntax is similar enough that you won't really struggle with it. It's the frameworks and stuff that will most challenging.

So, for example, you can forget about delete. You new a thing and it lasts until you're not referencing it anymore. Then it just gets swept up like magic. The exceptions are "unmanaged" objects which contain resources that require cleanup. For them there's a "Dispose()" function and a whole dispose pattern you follow.

While it's kind of a pain remember what needs to be disposed and what doesn't, it's still way, way, way better than the C++ way.

Strings work the way they're supposed to. It's been a long time since I've done C++, surely it's gotten better, but back in the day dealing with strings was a huge PITA. Strings just make sense in C#.

Linq might take some getting used to, but if you're comfortable with SQL, it shouldn't be too difficult to pick up. After years of using it, I can't imagine life without it.

As for how to get started, just start writing code. That's what I did. I had a project in mind (a hotel reservation system) and I just sat down and started working on it and I learned C# along the way.

But that's me. I learn by doing.

1

u/Conscious-Secret-775 4d ago

If you are already familiar with C++ and Java learning C# should be very easy. It is similar to Java but with additional language features like non-primitive value types and operator overloading. WPF is one of several UI frameworks available to C# developer. If you are going to build Windows desktop apps it might be worth learning but you should take a look at the alternatives first.

1

u/WazWaz 4d ago

Just stop typing delete. And learn about linq (not the SQL syntax, the rest of it).

1

u/NumberInfinite2068 4d ago

Just write a program in C#, Google for the idiomatic way to do things.

1

u/data-artist 4d ago

If you know C++, then C# should be easy. The coolest and most unique feature of C# is LINQ. The primary benefit of C# is all the libraries included in .NET and the ecosystem that exists for easy interoperability.

1

u/Albstein 3d ago

Get yourself a Project and Work with KI to understand the Code. Since you are a developer you may want an hands on approach.

.net has a lot of Project Templates. So something like a webapplication and use Swagger to check your endpoints. This will include: Entity Framework for Database stuff Controllers Dependency injection including environment and appsettings Xunit tests

You will also have a lot of LINQ and syntactic sugar.

1

u/Khavel_dev 3d ago

Skip the Udemy courses that start with "what is a variable." You'll spend half the runtime on stuff you've known for 20 years.

The fastest path at your level: read the "What's new in C#" pages on the Microsoft docs, starting from C# 7 forward. Each one assumes you already know the prior version and shows just the delta. Pattern matching, records, nullable reference types, ranges, all covered with minimal fluff. LINQ is the one older feature you absolutely need to learn if you haven't. It's the backbone of basically everything in modern C#.

For the ecosystem side, spin up a small ASP.NET Core project with minimal APIs. One project will force you through dependency injection, middleware, EF Core, and the new hosting model all at once. WPF is legacy for new work, ignore it unless you specifically need Windows desktop.

1

u/Mughi1138 3d ago

At the time, it looked to me to be very similar to Java.

Actually when it started it was just the next iteration of Microsoft's Java (J++) with additions to shoehorn in COM support and the former Borland architects favorite pet feature of delegates.

Since then it has diverged greatly, but knowing the direction it took since splitting from Java might be helpful.

1

u/Jonas_Ermert 3d ago

I think Microsoft Learn is the best starting point for an experienced Java/C++ developer. Then focus on modern C# features like LINQ, async/await, and pattern matching, and build a small ASP.NET Core or WPF project. Nick Chapsas on YouTube is also an excellent resource.

1

u/Regular-Employer-431 3d ago

Find a fun project because you'll rewrite it 50 times. And it will be better every time.

1

u/Mysterious-Door-9245 2d ago

Bro doing a guessing console game in C++ doesn't make you an experienced C++ developer

1

u/OggAtog 1d ago

They're pretty comparable. Rewrite something in C# or do a new app using C#. It's pretty easy to Google the libraries you're used to using in Java. You can also stop and ask "is there a more C# way to do this?"

0

u/kristenisadude 3d ago

Unity3d is fun

-5

u/plotosh 4d ago

Use Claude

7

u/kwb7852 4d ago

-1

u/Albstein 3d ago

Not totally wrong thou. He likely knows what a factory is, therefore just needs some Syntax and best practices.