Properties vs. Fields in C#

Поділитися
Вставка
  • Опубліковано 19 кві 2020
  • Why use an auto-property over a property with a backing field? What makes a property different from a public field? In this video I attempt to explain both and pull back the covers on how .NET code gets compiled.
    Original Reddit post: www.reddit.com/r/csharp/comme...
    Blog post: puurunen.ca/2020/04/17/proper...

КОМЕНТАРІ • 10

  • @codegate615
    @codegate615 4 роки тому +3

    I got to Derek Banas's section on c# construction properties and started to get confused. You've clarified. I see you're a new channel. With these kind of thoughtful lessons, I'll keep watching! Thanks.

  • @AnotherYouTubeUser581
    @AnotherYouTubeUser581 2 роки тому +2

    Hey Elias, if by any chance you will read this i just wanted to say that you are great. Im trying to learn C# for about half a year and I have to say it: Nobody on youtube explains it like you do. Most Tutorials think that the viewer is absolutely stupid or already knows everything. You are the middle-ground that i was looking for. Anyways im kind of sad that you do not make any more videos, but the videos you release are absolutely great nonetheless. Hope you have a great day !!!

    • @eliasexplains3493
      @eliasexplains3493  2 роки тому

      Maybe I'll make another video someday. What would you like to see?

    • @AnotherYouTubeUser581
      @AnotherYouTubeUser581 2 роки тому +1

      @@eliasexplains3493 hmmm, maybe the performance differences between instances and static classes? i see a lot of instances usage but it also seems that a lot of the functions could have also been static instead

  • @HaloWolf102
    @HaloWolf102 3 роки тому +1

    Great Video, however for a beginner programmer like myself. I 'understand' what you are talking about, yet the point doesn't make itself clear. Basically, I'm dumb. I need more simple words to convince me of whatever you are trying to relay to others.
    A good practice whenever you are teaching, especially in video format, is to give a simplified summary of what we just learned at the end of the video.
    Like 'fields are more flexible than public properties, and that is why they are preferred over properties' or 'properties get the concrete data in the memory, and sets it so nothing breaks, which is better over flexibility that a field gives you'.

  • @ryanheitmann7591
    @ryanheitmann7591 4 роки тому

    Really insightful, thanks for posting this!

  • @fistofjustice13
    @fistofjustice13 Рік тому

    what is a backing field? I'm trying to understand that

  • @tuga2112
    @tuga2112 3 роки тому

    this is an extremely long video to say "behind the scenes auto properties are a private variable with a setter and getter function, where public properties are a public variable" when the code is compiled, theres no suck thing as a public variable with the name of your property because what exists in the code is a private variable and 2 functions

  • @maq3009
    @maq3009 7 місяців тому +1

    I understood nothing you said. I'm a noob and I understood none of the words you said.

  • @developer20xx41
    @developer20xx41 3 роки тому +4

    Great. But its too long. Can you cut out the fluff and get to the point earlier