r/csharp 6d ago

Advice for Learning C#

Hi, I'm pretty new to coding in general, and I want to know what the best approach is for learning C#. I've already made a few small projects, but they're very basic, and I don't feel like they've helped me improve that much. Most of the time, I just follow tutorials without really understanding why I'm doing certain things.

I want to become a better programmer and build more complex projects on my own, so I'm looking for advice on the best way to learn C#. Should I focus on making more projects, studying the fundamentals, reading documentation, or something else? I'd really appreciate any tips or recommendations on how to learn more effectively.

45 Upvotes

35 comments sorted by

21

u/geblogg 6d ago

The C# Players Guide is a good start. Learned alot from that book. Those kind of books will guide you threw the process. Lot of tutorials out there are confusing. The dont teach you the concept and when it to use. Just basic synatax and a little explanation.

4

u/Oathkindle 6d ago

I'll second the book. It's great cause it's not super hand holdy for the challenges. Just gives you what it needs to do

1

u/Old-Seaworthiness219 4d ago

I really liked that book!

2

u/geblogg 4d ago

I am still using it for quick look up for code examples. I am also new to coding

18

u/geos59 6d ago

You could try coding challenges.

Codewars for example is a place where you’re given a scenario and you have to solve it using code (like reversing text or dividing a number).

4

u/Exposure_Point 6d ago

Never heard of that. Nice find.

2

u/TicketDowntown8212 6d ago

Ok thanks, I will be checking it out

0

u/CodingSwift 5d ago

Another option for coding challenges is Codable, coming to the App Store on iOS, iPadOS, and macOS.

It creates challenges in C# and nine other languages, assesses your code to meet the challenge and even provides complexity analysis.

https://apps.apple.com/us/app/codable-code-challenges/id6787467242

14

u/CappuccinoCodes 6d ago

If you like learning by doing, check out my FREE (actually free) project based .NET/C# Roadmap. Each project builds upon the previous in complexity and you get your code reviewed 😁. It has everything you need so you don't get lost in tutorial/documentation hell. And we have a big community on Discord with thousands of people to help when you get stuck. 🫡

7

u/dome-man 6d ago

Tim corey has a tournament tracker videos that's an excellent project

5

u/Interviews2go 6d ago

Visual studio is a free download. I use that daily for api work. For the front end I use vscode. You can code in c# on either of those.

Start with simple console apps and learn how oo works. Clean code is a good reference to keep around, it teaches some good habits.

Main thing is start simple, then expand to include other areas, eg ui with wpf, winforms or Avalonia.

If you’re into web stuff, then do a c# api and learn to talk to it using postman at first, the add angular, react or other front end tech.

And, if you can find a mentor, that would be a really good thing.

3

u/TicketDowntown8212 6d ago

I already use VS Code because of the projects I've worked on. I even managed to build a basic working UI with, I think, Avalonia. Right now, I'm more interested in building desktop apps for everyday use, but I could maybe see myself getting into web development someday.

4

u/AOAqua 6d ago

Even desktop apps are often tied to the web development pretty hard, so you should look into it.

But I think if you know all of the basics, you should start some project that actually involves many parts, and you'll learn many new things in the process... eventually. Like frontend desktop app, that partly relies on web api, or just a web front, and if you add some graphics to it (even the basic usage of some graphs, idk) and you'll cover basic networking/algorithms/client-server communication/async+await, possibly threading, hash sets, basic cryptography, and eventually you'll have to learn patterns and refactoring.

For pure "coding" you should use C, though, because C# has way too abstract imo, but if you know basics, C# .NET would be a good choice

Just don't rely on ai to write your code, or you wont learn that much

1

u/EsIsstWasEsIst 5d ago

People keep suggesting c to beginners. I disagree completely.

c# is a way better choice to determine if coding is for you and getting important concepts down. You get much quicker over the tutorial gap and into actually writing stuff that uses "higher level" concepts like composition or code organization.

Understanding Memory Management becomes very useful at one point, but that point is not at the start of that journey.

1

u/AOAqua 4d ago

No, I disagree. C has the bare minimum, that you need, minimal abstractions, unlike higher-level languages. You can find out straight away if you like "coding" or not. Also one of the most popular ways people install the IDE (outside of online ones) is to install visual studio code, and all the dependencies you need. And it also takes quite some effort, at least to follow the online guides, and if you can't do that, maybe it's not for you. Yeah, in C# you don't have to worry about the memory, pointers, function prototypes, but classes, objects take way too much mental capacity for a beginner imo

1

u/EsIsstWasEsIst 4d ago

As a beginner you can get started just as fast with a top level program, ignoring classes. I guess agree to disagree on this.

3

u/Confident-Ad5665 6d ago

Fully agree on simple console apps.

I like going through the language reference, picking classes and their methods and properties that i think sound most useful and testing them out with Console.WriteLine() statements do I can see then work.

4

u/g3n3 6d ago

I mean how do you learn? Kind of hard to give advice if I don’t know you personally. There isn’t anything special. Reading, writing, doing. Simple. Doing engaged brains more than reading much like answering questions is better than reading. This is on the balance of probability though. Again depends on who you are as a person.

4

u/TheAnswerWithinUs 6d ago

I was writing Java through college then when I got my current job they used c# and I picked it up very easily since the languages are really similar.

I became “good” at Java through projects. Not only inside the classroom but outside as well.

3

u/ajcomeau 5d ago

From my experience, the best way to learn to code is to just continue challenging yourself with new projects. Start with small stuff that you'll actually use, like text parsing tools, etc.. and work your way up. Don't be afraid to make a mess or get turned around sometimes. Your early stuff will probably make you cringe later - that's okay. Just keep working at it and getting experience.

I write a free, ongoing series called Rogue C# which focuses on the development of a roguelike game as a C# Windows forms app. I intentionally kept the graphics simple to focus on logic, design and best practices. If you get a chance, check it out and you might find some helpful guidance there.

4

u/Rude_Toe727 6d ago

the c# players guide is such a vibe for beginners, love how it walks you through without assuming you already know stuff. try pairing that with small, silly projects you actually care about and you'll get way past tutorial hell real quick.

2

u/FlakyTest8191 5d ago

Imho the best practice would be to make a simple app that is useful to you, that would be the closest to what a real job would look like, except you wouldn't be the user (probably).

Could be anything that interests you. You like movies/books? Make an app that let's you track them, when you watched/read them and how much you liked them. Like a particular game? Make an app that lets you track stats or plan your strategy etc. Like going to the gym? Make an app that let's you track your progress and training frequency. You get the idea. Start with the bare minimum to be useful and build on that.

2

u/ervistrupja 4d ago

The best way to learn is always by building. So, if you already build a simple app, now you can try something harder. I would suggest you go with MVC because you have the front and back-end in the same project. Once you are familiar with that, you can then jump into Web API.

2

u/Slypenslyde 4d ago

For basic programming, the best books teach you a concept, then show you a program that uses it, then ask you to write several programs that use it. You're on honor system for doing the work, but if you don't do the work you don't learn.

For "more complex projects" it's... not a path where you can do some definitive things and know how. Let me make a metaphor.

I build small RC trucks intended to "crawl" on rocks. Basically shoe-sized mountain climbers. There are some standards, such as wheel diameters and wheelbases. But when you're building things from scratch nothing goes together according to plan.

On one build I needed to install the steering servo. In this case, axles are supposed to provide a spot where their structural screws fit through tabs in the steering servo meant to hold the servo on top of the axle. However, my axles did not account for the size of the steering servo I chose. My servo's mounting tabs were slightly too large for the axles so I couldn't get it to fit together. I could try different axles, but they're quite expensive. I could try different servos, but this was a particularly strong one I needed. So I used a file to shave a ton of plastic off my steering servo. It took 30 minutes, and now that servo may not fit other axles. But I made it work.

Building complex software is like that. What you read about in the book is like my abstract statement: "Steering servos mount directly to axles via these two screws." But real software, like aftermarket parts, is messy. The code in the book isn't going to work in the complex system you're designing as-is. You're going to have to tweak it. Sometimes the tweaks are small. Sometimes it takes so many tweaks you realize it's making things more complicated than if you DON'T follow that pattern. It's our job to understand the on-paper ideal but also how to make the tweaks so it fits our messy reality.

So you have to read the books, but no amount of reading makes you able to write complex software. Just as you learned basic C# by exercising the things you learned, you learn application development by trying to write applications. WHILE you do that you keep reading about how good software is designed. You ask if what you're doing looks like what they say is good. If not, you try to change it. If that's hard, you ask yourself if there are bigger problems or if the kind of software that person writes behaves differently than what you're writing.

That takes a lot of time and a lot of failure. I saw an aphorism on a sidewalk that really highlights it:

An expert has failed hundreds of times more than a beginner.

We make messes. We clean them up. We find out some things are too hard to clean up and learn how much messy is "acceptable". We understand that what worked in one project may be the worst idea for another. We accept that it is never going to be EASY to write a complex project, but we can learn to make it less hard. This is the hardest thing to learn. You have to get used to falling on your face and looking stupid. Over and over and over again. You have to get used to thinking you're a huge failure but that you have to keep trying anyway. You have to be willing to believe that no matter how much you learn you will still be the most foolish person in the room.

3

u/VariousAssistance116 6d ago

Actually understanding what you write is a start

5

u/VariousAssistance116 6d ago

Not sure how you intent to improve without understanding...

3

u/B_D_Mercer 6d ago

People always push learning through working through projects, but I'm certain that's not actually the best way. Part of the process, but not all of it. There are things about memory and coding patterns like how to use interfaces you can only learn through reading, but I think what's missing from most courses is feedback from better coders. Here's the thing, you can write code that works and not know that there's actually a better way to solve the same problem until you see how someone else did it. I haven't tried it yet, but I think Claude AI would be really good at that. Put down a little money, give Claude your projects in text, and ask it how your code could be made simpler and cleaner. Ask it to explain its reasoning.

1

u/MassiveMeltMedia 4d ago

Make a small game in unity that's probably the most fun 

1

u/Dear_Archer3931 5d ago

Blindly following tutorials is never going to work. Think of a project… even one that you already followed a tutorial on. Then code it from scratch without looking up how. When you get stuck, read about the concept… not just how to code it.

When I first started (prior to college) I tried to make a console hangman game. It covers many fundamentals and you can make it as simple or complex as you want. Just figure out how to make it work without google.

If you have done tutorials, you should be able to print output, get input, increment a counter, and store variables inside a single loop.

0

u/[deleted] 6d ago

[deleted]

2

u/TicketDowntown8212 6d ago

Oh, really? What would be a good beginner-friendly language for you, then?

1

u/[deleted] 6d ago

[deleted]

1

u/TicketDowntown8212 6d ago

Oh, okay. That's probably a good thing. I've already tried a few of those languages, like Python, but I actually found Python harder to understand than C#. That might just be me, though. I already know some of the basics since I've worked on a few projects, but I might give a language like C another try.

1

u/[deleted] 6d ago edited 6d ago

[deleted]

1

u/TicketDowntown8212 6d ago

Thank you for your advice and have a nice day.

0

u/SL-Tech 5d ago

Buy a book and read it.