I have some background in Python and Bash (this is entirely self-taught and i think the easiest language from all). I know that C# is much different, propably this is why it is hard. I’ve been learning it for more than 4 months now, and the most impressive thing i can do with some luck is to write a console application that reads 2 values from the terminal, adds them together and prints out the result. Yes, seriously. The main problem is that there are not much usable resources to learn C#. For bash, there is Linux, a shit ton of distros, even BSD, MacOS and Solaris uses it. For python, there are games and qtile window manager. For C, there is dwm. I don’t know anything like these for C#, except Codingame, but that just goes straight to the deep waters and i have no idea what to do. Is my whole approach wrong? How am i supposed to learn C#? I’m seriously not the sharpest tool in the shed, but i have a pretty good understanding of hardware, networking, security, privacy. Programming is beyond me however, except for small basic scripts
I have a Python background and I’m learning C# right now. Unity development is done in C# if your interested in games or 3D applications. There’s a ton of resources for that kind of think out there and I find its a fun context to learn in. I’ve also had decent results recreating tutorials written for other languages using LLMs. Just start with step 1 as a premise and state the overall goal, then ask for incremental changes at each step an ask questions and for alternate solutions. Just watch out for those hallucinations.
I just jumped in, start making some cool projects
With basically no knowledge? I could create a new project using chatgpt but i will not learn c# with that
With basically no knowledge?
Well yeah. You find yourself some simple project and try to build it. When you don’t know how to do something, you look it up.
Like, make a command line clock, for example. Figure out how to get the current time, and then how to print it. And after that how to make it print the time once a second.
Edit: probably the most important skill in programming is breaking the problem into smaller pieces that you can then figure out. With experience, getting stuck like this becomes much less of a problem.
That’s just basically looking up the answer. Even if i find it (which is unlikely without asking an llm), i will not learn anything from it. I tried creating a wimforms application with the same method, and eventually succeeded. But i don’t know how i did it, and i couldn’t recreate it by myself. This is the problem
That’s just basically looking up the answer. … i will not learn anything from it.
Looking up the answer is the way to do it. You’re of course supposed to pay at some attention instead of copy-pasting without using your brains. As you keep doing things, you’ll develop a rough idea of how things are done.
Even if i find it (which is unlikely without asking an llm)
But i don’t know how i did it, and i couldn’t recreate it by myself.
You mean building the thing without any reference? Except for the most basics, you’re not supposed to memorize everything by the smallest details. Imagine asking a lawyer to know the details of every single law off the top of their head.
Seriously, go build that clock.
I agree with all the advice given in this thread. I just want to add that I think you should try to avoid chatgpt (or least use it in a way it explains the problem to you without giving you the answer), as it solves trivial problems easily, and solves complex problems with bugs.
I learned everything I know about c# by looking it up on Google, copy and paste is king. Just keep working with it until you can make sense out of the code you’re copying. An llm would work similar but might feed you bs, everything you’ll want to know is on stack overflow. You’re unlikely to have an original, unasked question…I never have.
It sounds like you’d benefit from having a project in mind. I always learned programming languages by building something I wanted, or by tinkering on someone else’s project.
That could be good in the future but i struggle with the basics too. I look at source code and have absolutely no idea what it does
It sounds like you either have not integrated ChatGPT into your life yet or you’d never think of asking a tech-tool tech-related questions.
All my code in the last year has been written up by AI. Sure, for now you still need to know what you’re doing, the code pretty much always needs adjustments, but your first draft is never farther than one LLM query away.
If you tell him what you just told us, like “I’ve spent months and all I can do is parse some values, what could I code to expand my horizon?” you will have new angles in minutes and all key lines of the code will be explained to you.
Using AI is cheating and no teachers like it. We are ecouraged to learn entirely without any LLM or similiar. Sure, i could pull it off, when the teacher is not watching, but that’s very risky
I thought you were learning by yourself. If you have a teacher/class and you need to consult the internet for advice that probably doesn’t bode well for your teacher’s performance.
I’m not suggesting to use AI to cheat on a test or something, even with the existence of AI we should still try to build our own knowledge and understanding. But I mean if you got some homework or whatever and you feel like your understanding should already be further developed why not ask an advisor which has time for you 24/7? What counts is your own progress and nothing else. The goal isn’t to let AI do the work and be done with it but to gain an understanding which your teacher seemingly couldn’t convey to you.
this is just horrible advice
Code is overwhelming. Even experienced professionals hate diving in to somebody else’s code. It’s scary, poorly documented and we always think we could have done it better.
Don’t let that put you off.
A lot of us are practical learners. So like you we stare at a wall of code but struggle to comprehend it. But if you dive in and start editing, experimenting etc you’ll change the output and understand why it was written in a certain way.
Eventually once you’ve got it sussed you’ll be able to adapt a script to do what you want it. That’ll trigger the dopamine reward mechanism and you’ll be hooked like the rest of us.
learn java, way more material for that, but conceptionally very similar to c#. I suggest a book like “Head first Java”.
after that c# will be much easier to grasp.
Is java easier to understand than c#, for someone who only has some experience with scripting languages?
C# is like Microsoft-branded java. No real difference in the language, but some of the tooling for java is worse.
no, i don’t think there is a big difference in ‘difficulty’ between both languages.
there is just more material for java, and as i said the languages are very similar, so learing to program in java wont be a waste of time if you plan to only use c# after that, because the concepts you learned a long the way will easily carry over.
I considered saying the same thing, but C# has been around almost as long as Java at this point, and I believe it’s commonly used for teaching, so I have a hard time believing there’s a shortage of learning resources. Starting with Java seems like a waste of time if your goal is to learn C#, because you can learn the concepts equally well in either language, but if OP starts with Java they’ll end up spending a lot of time unlearning Java quirks and APIs while learning the equivalent stuff for C#.
Not only this, but C# has diverged enough from Java that anything but the absolute basics isn’t going to help much with C#.
Starting with Visual Studio (not code) helps a ton. Make a simple winforms application with a button and some labels and you will start to see how it ‘starts up’ from program.cs to your form.
I did it once but needed a lot of assistance and it was very confusing
Microsoft produces a plethora of good learning materials if you’re struggling with the basics or specific concepts. I recommend their C# for Beginners course to get a good overview of real C#.
Once you have a good handle on the basics, I would echo others’ advice that having some kind of project or goal to work towards is the surest path to learning, because you have external motivation to use what you’re learning and look up things as you need them. Is there some reason you chose C# specifically as your next language, maybe for game dev, web dev, or Windows apps?
I did not choose C#, and after Python, i’d have chosen Javascript, Lua, or Java if it was my choice. I learn it in school, for some reason. My teacher is not very good at explaining things and basically leverages everything on us without teaching how to do it. And also, we learn c# once a week, which is propably not the intended way to learn a programming language anyway, and even then, most lessons are about flowcharts, number systems. Anyone who can learn c# in this enviroment is an absolute genius. Of course the whole class struggles with it
Getting exposure to the language only once a week will definitely hinder you a lot. When learning a language, there’s a bunch of stuff you’ll memorize without even thinking about it if you spend time working on it every day, but it will be hard to remember if you spend a week between learning sessions.
I have a lot more things to learn and it is understandable that i want to unwind a bit or learn something that i actually enjoy, rather than suck with c# with absolutely no motivation. Like i don’t know how i was supposed to learn multiple languages at once and understand both
Like i don’t know how i was supposed to learn multiple languages at once and understand both
Because the differences between languages isn’t often that big (in most cases).
They have the same concepts with different syntax. Like with spoken languages - you know there are verbs, nouns, etc. but not what the other languages call a “library”.
Nearly all computer languages have an entrypoint, conditionals (if … then), loops (for, while), datatypes (integers, floating points, strings), complex structures (class, objects, structs) and functions.
You seem motivated to learn but struggling with your instructor. Copy/paste from course material in an annoying way to learn. What helps is to really “get in there”. To debug something. Only then will you truly hate programming 😁.
Others have suggested a personal project and I’d recommend it too. Even simple things are fine - but try to modify them to do more and more. The more you’re iterating over the same codebase the more comfortable you’ll become with it.
Harvard University makes CS50 (an intro to programming course) freely available and it’s excellent. It does use Python, which won’t help with the specifics of C#, but it would help with the other gaps in your knowledge.
And remember - concepts translate between languages, so if you understand classes in Python then you just need to learn “how does C# do classes?”.
The languages i used up until now do not have entry points (intrepeted). I know what is that, but i don’t know where they should be. Up until now, i only used llms for debugging, i’m far from correcting source code, i’m happy if i can write something that even remotely resembles to the correct structure. Also, is it a good idea to start adding smaller functions to already existing c# projects made by others on github (not to publish, just for myself, don’t want to ruin someone’s work with malicious commits). My python understanding is vague too. Only class i ever defined was a csv file reading class like class Class: def init(self, stuff1, stuff2): self.stuff1 = str(stuff1) self.stuff2 = int(stuff2)
Checkout CS50. It’s free and should help with the basics, even if it does use Python rather than C#. As I said before - the concepts are transferable. You need to learn more than just “syntax”.
Programming can be hard at first. Don’t be discouraged if you find it confusing or if you need to start with very simple things. There is a lot to learn so keep your expectations low, and feel free to return and ask questions. And if you’re comfortable using AI you can use it to explain concepts and code rather than just having it spit out solutions. It’s usually pretty good for this since there is a lot of material on the internet for it to have learned from.
So… When you first start leaning to code you need to learn a lot of concepts, not just the language.
Flowcharts help to teach about code flow, conditionals, loops, etc.
You may be concentrating too much on language specifics. You’re not learning C# - you’re leaning to program using C#. There is a lot of theory behind programming languages.
C# was the first language I learned in school, there’s plenty of beginner resources for it on Youtube. You can also try some projects using Windows Form Applications (janky but fun) or the Unity game engine, which has tons of resources online.
An IDE with auto-complete would help a lot.
- Make a text adventure game that runs in the console.
- Tic tac toe in the console.
Then if you want to go for a GUI web app with react use “dotnet new react” and create a to-do list with a client/server setup.
If you want to learn to make games you could make a tic tac toe again but with a GUI in Godot.
Once that’s done make tetris.
You research what you need right before you need it and use it immediately so it sticks better. You’ll need to get comfy with typing systems and I recommend using an IDE like Rider or Visual Studio to program it since they help out a lot.
one of the most popular languages, used in one of the most popular game engines, has no learning resources?
Press X to doubt
Yeah but then you have to learn MATH and I’m not doing that.
Depends how you learn. Being mindful of what your goal is helps. C# can be used for console apps, it can also be used to make ASP.Net websites, further afield you can program the Unity games engine with C#. Each of these will have “absolute beginner most basic first steps” type tutorials out there. They’ll all have some similarity as you’ll need to just learn the C# syntax one way out another, but it miles easier doing this if you’re vaguely interested in the types of apps you’re heading towards.
If all else fails, message me, I was there once, about 20 years ago…
You think Bash is the easiest language? I have to Google the syntax every time i need to write and IF statement!
Thisss, it’s atrocious
There’s a few languages I come back to after a while to fix something and have to consult their reference manual / docs. But bash is the only one where that’s necessary just to read back my own code. Like [[ -z ${ARG} ]]? Wtf is -z doing here. Wtf kind of syntax is that.
Next time I think oh this could be automated with a little bash scrip I’m going to investigate one of those compiles-to-bash languages.
it’s the second language that comes to mind when I think of the word “footgun”, right after old c++
I found C# to pretty much be python just with strict types and semicolons. Jumped right into it really on my first job and it worked out pretty fine, granted I got to orient myself in the existing project where I started.
You are perhaps already familiar, but some things stand out like public/private annotations and other class related things like interfaces which work to create a more organized and controlled use compared to pythons “we are all consenting adults” approach were nothing ever really truly blocked from you. It depends a little on what you want to do/use it for, there’s frameworks and different uses like WPF / .NET for the frontend.
While it may be too basic for you, ZetCode was useful for me back when learning PyQt in python, so you might find some use with the C# intro: https://zetcode.com/all/#csharp
You propably don’t know how bad i’m in C#. Basic console apps are giving me trouble. I think it is very different from python. Like nothing is the same, at all
I sure don’t sound helpful saying this, but it’s mostly about finding the equivalent to the python action/types, and typing them out when making functions and variables. Though 99% of the time, you are completely fine defining variables as
var
to avoid excessive typing.I assume you dealt a bit with classes in python, if not then you’re doing double time with both changing language and learning object oriented classes at the same time.
If there is any specific I can try to give some clarity since I also came from Python to C#.
We only created simple functions and reading from file in python, with def
This is how I feel about music
- Start writing a small game in Godot using GDScript (basically Python)
- Use the Godot docs to read about C# alternatives to GDScript as you go, compare them and see how they differ
- Translate bit by bit of your game to C# using the docs
- Congrats, you have written a game in C#