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

  • DrDeadCrash@programming.dev
    link
    fedilink
    arrow-up
    7
    ·
    14 days ago

    Check out this reference (not mine): https://gist.github.com/DanielKoehler/606b022ec522a67a0cf3

    The first difference that I would point out is c# use of static typing, where python is dynamic. This author is using the var keyword to avoid specifying a type for variables. The type is, instead infered by the code that follows the equals sign.

    The next main difference is the use of whitespace. Python is very whitespace aware, it uses indentation and line breaks to organize code. C# is whitespace agnostic in most cases and separates blocks of code using curly braces {…}, statements must end with a semicolon;

    In C# collections are organized by how the data is accessed and whether elements can be added or removed. Arrays are initialized with a set of items and can’t be made longer, a List can be added to and can be removed. The key point is that all items in a collection are of the same type.

    Complex objects (that have properties and methods) can be structs, classes, or records but they all basically do the same thing and interact in the samish way. You have to use the new keyword to make a new instance.

    Classes and records can inherit from another where as structs cannot. Properties must have a type, methods must return a type or void. Method parameters must be typed, when calling a method the provided parameters must be of the proper type.

    An interface describes requirements an implementing class, record or stuct must meet (i.e. properties and methods). You can’t make a new interface, it’s more of a qualification.

    I hope this helps some

      • DaleGribble88@programming.dev
        link
        fedilink
        English
        arrow-up
        8
        ·
        14 days ago

        Most probably, yes. A lot of these are fundamental concepts of most modern object-oriented languages that I am familiar with. It may be worth refreshing your basic programming skills/concepts with a book you like. There are plenty available online for free in C#, Java, C++, Go, etc.

        • kekmacska@lemmy.zipOP
          link
          fedilink
          English
          arrow-up
          1
          ·
          14 days ago

          Refreshing what? I don’t have anything to refresh here. I only have experience with scripting languages, which are not object oriented at all

          • atzanteol@sh.itjust.works
            link
            fedilink
            English
            arrow-up
            7
            ·
            14 days ago

            This is going to sound harsh but… You need to take an intro to programming course.

            I didn’t know what your doing in Python, but you’ve not learned to program in Python. Maybe just copy pasting or making small changes to existing stuff? Working in a specific framework? Are you writing code from scratch?

            You need to understand datatypes (a concept Python tries to hide from you and imo does a disservice to novices), structures, conditional is, loops, etc. These concepts aren’t language specific.

            • kekmacska@lemmy.zipOP
              link
              fedilink
              English
              arrow-up
              2
              ·
              edit-2
              14 days ago

              Yes, i write from scratch in python, but only basic things. The most advanced are reading from a file and defining an own function. I’m in a programming course already

      • vrighter@discuss.tchncs.de
        link
        fedilink
        arrow-up
        5
        ·
        edit-2
        14 days ago

        Quite bad actually, since most of this stuff is not specific to c#, and are just basic programming concepts. This leads me to believe that your python experience is “coby and paste stuff in until it looks like it works”, and you never took the time to understand what the code does.

      • Caveman@lemmy.world
        link
        fedilink
        arrow-up
        4
        ·
        14 days ago

        I wouldn’t say it’s that bad, it probably means you lack vocabulary rather than anything else.

  • Kogasa@programming.dev
    link
    fedilink
    arrow-up
    5
    ·
    14 days ago

    Start with the goal to create something, be it a console app, website, web api, or game. It’s hard to just study a language abstractly and learn it. Use the Microsoft Learn documentation as reference, and look for open source .NET projects on GitHub to get different perspectives on how to build things with .NET. There is a free course on freecodecamp that will get you started by building an app, and I believe it was done in partnership with Microsoft

  • Apparatus@programming.dev
    link
    fedilink
    arrow-up
    4
    ·
    14 days ago

    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.

  • 31337@sh.itjust.works
    link
    fedilink
    arrow-up
    2
    ·
    13 days ago

    I learned it because I had to write a WPF desktop application, so you could start with WPF tutorials. I was already very familiar with Java, which is very similar, so it wasn’t too hard. Last time I used it was in Unity. You might want to find a good free online course for C# to get a good grasp of C#/Java’s style of OOP, design patterns, and all that kind of stuff.

  • briggsyj@programming.dev
    link
    fedilink
    arrow-up
    3
    ·
    edit-2
    13 days ago

    When I was learning c#, I found the .Net framework tutorials available on freecodecamp to be good.

    Also, using the Jetbrains Rider IDE (assuming this is for private non-commercial purposes, as per the terms of their free license) rather than VSCode or Visual Studio. VSCode is still lacking in features when it comes to c#, and Visual Studio probably makes more sense if you’re already accustomed to c# dev.

  • eldain@feddit.nl
    link
    fedilink
    arrow-up
    4
    ·
    13 days ago

    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.

  • vrighter@discuss.tchncs.de
    link
    fedilink
    arrow-up
    37
    ·
    14 days ago

    one of the most popular languages, used in one of the most popular game engines, has no learning resources?

    Press X to doubt

  • Dunstabzugshaubitze@feddit.org
    link
    fedilink
    arrow-up
    1
    arrow-down
    8
    ·
    14 days ago

    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.

    • lolcatnip@reddthat.com
      link
      fedilink
      English
      arrow-up
      8
      ·
      edit-2
      14 days ago

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

      • TehPers@beehaw.org
        link
        fedilink
        English
        arrow-up
        2
        ·
        14 days ago

        Not only this, but C# has diverged enough from Java that anything but the absolute basics isn’t going to help much with C#.

    • kekmacska@lemmy.zipOP
      link
      fedilink
      English
      arrow-up
      2
      arrow-down
      1
      ·
      edit-2
      14 days ago

      Is java easier to understand than c#, for someone who only has some experience with scripting languages?

      • Dunstabzugshaubitze@feddit.org
        link
        fedilink
        arrow-up
        2
        ·
        14 days ago

        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.

      • sevon@lemmy.kde.social
        link
        fedilink
        arrow-up
        4
        ·
        14 days ago

        C# is like Microsoft-branded java. No real difference in the language, but some of the tooling for java is worse.

      • aluminium@lemmy.world
        link
        fedilink
        arrow-up
        1
        ·
        13 days ago

        I personally find Java easier in the sense you have to get things done with pretty simple tools, while C# you have 10 different options for a problem.

        Also makes it easier when looking at other people’s code since everyone uses the same basic tools.

  • Michal@programming.dev
    link
    fedilink
    arrow-up
    40
    ·
    14 days ago

    You think Bash is the easiest language? I have to Google the syntax every time i need to write and IF statement!

    • alex@programming.dev
      link
      fedilink
      arrow-up
      3
      ·
      13 days ago

      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.

  • ngcbassman@sh.itjust.works
    link
    fedilink
    arrow-up
    5
    ·
    14 days ago

    Why you need or want to learn C#? I think depending on the answer we can find a good starting point on how to approach your learning because is not just about the language, also about the ecosystem.

    • kekmacska@lemmy.zipOP
      link
      fedilink
      English
      arrow-up
      3
      ·
      14 days ago

      Because it is required in my school. And we barely have any classes, even then, the teacher is not really good at teaching it. He thinks we will learn by copy-pasting it from the board. This is literally what we have to do in class. And for some reason, he is the principal

      • Rogue@feddit.uk
        link
        fedilink
        arrow-up
        3
        ·
        14 days ago

        Do the other students feel the same way? It might be worth starting a study group amongst your peers to help one another out.

        Have you reached out to your teacher? they should be able to either help you catch up or steer you towards resources that better suit your pace/ learning style.

        • kekmacska@lemmy.zipOP
          link
          fedilink
          English
          arrow-up
          4
          ·
          14 days ago

          Yes, they do but we are not a good community, they are not really helpful. The teacher is the principal. He barely has time to come to the lesson, i doubt he has the time and intrest to care about students who can’t understand what is going on. Plus he is not that approachable person, very strict and not that helpful

      • ngcbassman@sh.itjust.works
        link
        fedilink
        arrow-up
        1
        ·
        14 days ago

        Ok, so if is for school, what is the context? Is a class about C#, about OOP, or programming languages, or creating a website or creating a videogame. I’ll try to cover different focuses.

        C#, if is just about the language, I’d think is a bit strange, I feel that at school level you want to relate a programming language to a more fundamental concept that you can find in other languages as well, rather than sth this specific. Anyway, things like memory management: memory allocation, value/reference, garbage collection, or things like async/await, Tasks, LINQ, polymorphism, the different types and keywords and the .NET framework are important at this level.

        C# is a multi paradigm language so you can implement stuff mainly in OOP, but also functional, imperative and others, I’m going to assume that the idea is to use it more as OOP, if you have used already OOP in Python you just need to find what are the features and constraints of C# around this compared with Python.

        A console project may help you to understand these concepts, but at the end it will depend in what you want/need to learn to focus on what kind of project is better to implement for learning. If is just the concepts in OOP in C# any simple project can help you on that, for instance you can use a Code Kata and you can add specific requirements about covering OOP concepts so you force you to learn and practice that, even if is over engineered.

        If your plan is more related to a project implementation, that’s a different story, because now you have to consider not just the building process, but also the deployment process, so not just about the language, and in this it matter less some specific stuff about the language and more about how to implement some stuff using already libraries, so is more about putting things together having in mind good practices, and also how you pack the binaries and distribute them. Other stuff, where the app will run, how do you monitor your app while is running, do you need persistence? Do you need logging, do you need security, etc.

        • kekmacska@lemmy.zipOP
          link
          fedilink
          English
          arrow-up
          1
          ·
          14 days ago

          The class is: algorythms and data structures. The teacher teaches just that, instead of C#. The most we had to do with c# is copying something from the whiteboard. Yet, there will be a c# test and everybody is terrified, me included. I never used python as OOP. In python we only do reading from file and creating own functions, these are the most advanced things. I don’t understand why we have to learn 2 languages at once, even 1 is a very big task for someome who is completly new to programming, and that’s how i began, and i’m still propably. And for first i just need it to work and to understand it, nothing special

  • Corngood@lemmy.ml
    link
    fedilink
    arrow-up
    16
    ·
    14 days ago

    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.

    • kekmacska@lemmy.zipOP
      link
      fedilink
      English
      arrow-up
      5
      arrow-down
      5
      ·
      14 days ago

      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

      • Rogue@feddit.uk
        link
        fedilink
        arrow-up
        12
        arrow-down
        1
        ·
        14 days ago

        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.

        • Chris@programming.dev
          link
          fedilink
          English
          arrow-up
          1
          ·
          13 days ago

          The comment above stands on its own. Code can be overwhelming - start by going through an existing program and write a comment for every single line - describing exactly what each line does. You’ll pick it up faster than you think.

      • desentizised@lemm.ee
        link
        fedilink
        arrow-up
        1
        arrow-down
        9
        ·
        13 days ago

        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.

        • kekmacska@lemmy.zipOP
          link
          fedilink
          English
          arrow-up
          2
          ·
          edit-2
          13 days ago

          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

          • desentizised@lemm.ee
            link
            fedilink
            arrow-up
            2
            ·
            13 days ago

            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.

            • kekmacska@lemmy.zipOP
              link
              fedilink
              English
              arrow-up
              1
              ·
              11 days ago

              Ah ok, i understand. I sometimes ask AI to explain it, i try to memorize the explaination and write it