Getters & Setters | C# | Tutorial 28

Поделиться
HTML-код
  • Опубликовано: 11 окт 2024
  • Source Code - www.giraffeacad... This video is one in a series of videos where we'll be looking at programming in C#. The course is designed for new programmers, and will introduce common programming topics using the C# language.
    Throughout the course we'll be looking at various topics including variables, arrays, getting user input, loops, conditionals, object orientation and much more.

Комментарии • 217

  • @nereidia3390
    @nereidia3390 6 лет назад +314

    Teacher lectured about getters and setters for 2 hours and after class I didn't have a clue what they were. This 12 mins video explained them well and now I understand them. Thanks.

    • @mcredifine
      @mcredifine 5 лет назад +27

      this is basically 3years of math courses for me. Uni teachers explain subject in 2h and nobody got any of that(mostly because it's just theory and not actual practice) then you go home and an awesome guy like this explains the subject to you in 10 min. youtube, udemy, and wikipedia are our generation's true teachers

    • @navjotsingh2251
      @navjotsingh2251 4 года назад +3

      Michael K don’t put all lecturers under that category. My math and comp sci lecturers are both excellent, they focus on both theory and intuition at the same time, they make sure we have the intuition to understand what it going on.

    • @konnelius
      @konnelius 4 года назад

      this... so much this.

    • @bingkysskiliwaax7941
      @bingkysskiliwaax7941 4 года назад +3

      @@navjotsingh2251 hes not talking bout your...... Teachers

    • @alexllesol8048
      @alexllesol8048 3 года назад +1

      You guys have discussions?

  • @MizzouAntler
    @MizzouAntler 4 года назад +80

    Dude, seriously. I am in an online class and have been close to tears because I thought I was too dumb to understand OOP. You are a life-saver!

    • @aba22125
      @aba22125 2 года назад +13

      You're not too dumb, even people with high IQs and whatnot struggle to grasp this. And almost all professors suck at teaching these concepts -- that doesn't really help either.

    • @hadiimran9106
      @hadiimran9106 Год назад +1

      Omg I thought it’s only me today very reluctantly I gathered my courage and ask my tutor to explain this concept to me didn’t really get my head round it however this dude has made everything crystal clear 😂

  • @sethschiele3218
    @sethschiele3218 4 года назад +13

    I cant get over how fluid my man is with the knowledge. Thank you Mike!

  • @TheIsolatedGamerz
    @TheIsolatedGamerz 6 лет назад +78

    hey man you very clear and concise. Great job

  • @KarlooAudi
    @KarlooAudi 5 лет назад +44

    You are so good at this, I wish you made more of c#

  • @StayAware9
    @StayAware9 3 года назад +10

    Bro you are a born teacher...Your explanations created my IT career💖💖💖💖💖

  • @Moss2323
    @Moss2323 9 месяцев назад

    Three things discouraged me from proceeding with learning oop 15 years ago - constructors, get(), set(). The more I read on these the more confused they became. Even many other videos on youtube leaves you more confused. You simplied everything within few minutes. The feeling is just on another level. You are a great teacher.

  • @SebLeCaribou
    @SebLeCaribou 2 года назад +8

    Four years later, still the best way to understand the concept of getters and setters.

  • @PeterMucha0811
    @PeterMucha0811 2 года назад +1

    Periodically over the past 6 years, I've watched all the LinkedIn courses and many nights trying to wrap my head around this concept "ended up more confused than when I started." Your teaching method gave me a complete understanding, and I can finally finish my program.

  • @nasimnaji9405
    @nasimnaji9405 4 года назад +3

    Not only you're a great programmer, but your teaching skills are also quite impressive. Very informative thank you.

  • @formyeve
    @formyeve 2 года назад +1

    I literally spent 4 years trying to learn getters and setters and didn't have a clue what they were. This short video explained them perfectly and now I understand them. Thank you!

  • @TurboWindex
    @TurboWindex 4 года назад +4

    Thank you so much for taking some of your time to share what you've learned over the years in a very compact and relatively easy to understand manner. Big love from Canada !

  • @Dotto19
    @Dotto19 5 лет назад +16

    Thank you Mike,
    You've made this topic really easy to understand.

  • @ryan_raus
    @ryan_raus 3 месяца назад

    This is the greatest getter and setter explanation I’ve ever seen

  • @XIsleTheWanderer
    @XIsleTheWanderer 3 года назад +1

    So, I watched all the way through your whole C# series, and thought I had a grasp on what you were teaching. Only to go try and write my own program and have no idea where to begin. Once I realized I needed to understand the overall way of thinking like a programmer, I began to be able to apply what you taught.
    Now, coming back to your videos for reference, I'm finding that uou are the best teacher I've seen yet.
    Keep it up!

    • @shallanrambaran6942
      @shallanrambaran6942 2 года назад +3

      For anybody reading the comment above who are looking for the 'foundation' (eg. thinking like a programmer); look for the free CS50 course (by Harvard University Lecturer - David J Malan) on RUclips. This will help you very nicely! Good luck and Godspeed to all my fellow potential programmers out there!

    • @shafialanower3820
      @shafialanower3820 11 месяцев назад +1

      How did you leaarn to think like a programmer? Is it more practice problems?

    • @shafialanower3820
      @shafialanower3820 11 месяцев назад

      Thank you for the refrence. I don't know how to think like a programmer yet. My instic is to solve problems by seeing which syntax fits the problem but that is a very bad habbit@@shallanrambaran6942

    • @XIsleTheWanderer
      @XIsleTheWanderer 11 месяцев назад

      @shafialanower3820 For me it really was just a lot of practicing. Unfortunately ChatGPT wasn't a thing I had access to when I was trying to figure it all out; but honestly that's gonna be your best bet for any questions, and helping to explain things you feel like you're struggling to understand

  • @gruzzleybear7405
    @gruzzleybear7405 6 лет назад +5

    I have watched several videos and I did not understand it until now. Thank you

  • @jonothen2212
    @jonothen2212 3 года назад +1

    Good job brother, I can’t believe how easy to follow and understand ur content is, i have searched for vid after vid none of em very clear and u killing it man
    Absolutely superb bro!

  • @void3887
    @void3887 4 года назад +3

    This saved my life! Thank you! This video is fantastic and describes perfectly what I needed to understand to get my assignment done tonight.

  • @thele99
    @thele99 3 года назад +2

    OMG! I name all my method parameters with the prefix of "a" or "arg" -- I took a lot of crap from that over the years. You're the only other person I've seen that does this! I feel... validated.

    • @BGraves
      @BGraves 2 года назад

      That just sounds like an improvement to the existing naming convention, especially to distinguish what is what to newbies at a glance. Microsoft only says "When writing method parameters, use camel casing." So keep doing what you're doing

    • @Chilli_Tea
      @Chilli_Tea 2 года назад

      I do this too, I just find it less confusing tbh

  • @rajinderbedi7632
    @rajinderbedi7632 2 года назад

    You are a life- saver bro ! Struggled for hours and got the logic within 12 minutes ! keep it up

  • @rodrigo1300
    @rodrigo1300 5 лет назад +1

    From all the programmers I saw on RUclips. Mike is for sure the best.

  • @athariealfuraih8115
    @athariealfuraih8115 3 года назад +1

    I love how simple and clear your explanations are ! Thank you!!

  • @W0wH0bbs
    @W0wH0bbs 2 года назад

    Thanks. Was having trouble creating multiple setters and getters in one class and this helped my organization!

  • @wesleysigner769
    @wesleysigner769 Год назад

    I don’t know why I wasn’t able to grasp getters and setters before this, but this really helped me. Thank you

  • @evelinke
    @evelinke 3 месяца назад

    Thanks, you're a lifesaver. I've been stuck with this for days now. Also, it's Andrew Adamson.

  • @wackyjoker7912
    @wackyjoker7912 4 года назад +2

    very good explain and examples, one of the best i've found in entire internet that i can understand.

  • @ovey2214
    @ovey2214 4 года назад

    I just need to go to all of your videos and give a thumbs up. You make things so incredibly easy to understand that I'm dumbfounded at how hard some others make things! You do an incredible job and I REALLY appreciate your videos!

  • @tbtv9051
    @tbtv9051 4 года назад

    The best explanation I’ve heard yet! I heard/watched a couple in my native language but don’t get a clue what these guys talking about. Thanks!

  • @spillysock-spock9929
    @spillysock-spock9929 Год назад

    Thank you, I have been learning c# through solo learn and their explanations have been getting very unhelpful this helped me understand properties far better

  • @JanekBaranek
    @JanekBaranek 5 лет назад +1

    The best movie on YT on Get and Set in C#!!!! You are legend! Explained me what teacher could not ;)

  • @ss5380
    @ss5380 3 года назад

    Thanks a lot man for simplifying this. I was almost on the verge of dropping out from the course at school. You're a lifesaver!!

  • @taylornguyen2503
    @taylornguyen2503 10 месяцев назад +1

    This is why Programming classes in colleges and university are equally hated. They explained a concept for 2 hours and no one can understand it but a programmer on youtube can do it for under 15 minutes

  • @mzamomahaeng268
    @mzamomahaeng268 3 года назад

    I'm new to C# and this lesson made sense.Well explained sir.Thanks

  • @chimerablack4913
    @chimerablack4913 5 лет назад +8

    Awesome tutorial bro! I would only make one suggestion and that is to use a Switch statement rather than an "If" when you have more than 3 conditions to test, as it gets hard to read when you have one long list of "ORs""

  • @asifkazmi8733
    @asifkazmi8733 4 года назад

    Fantastic. I somewhat understood what getters and setters were, I just didn't know why you needed them, the motive. Now I see... thanks!

  • @ranjanadissanayaka5390
    @ranjanadissanayaka5390 9 месяцев назад +1

    awesome Mike!! You are the best. 😀😀

  • @TheUnknownGuy85
    @TheUnknownGuy85 2 года назад

    a very good teacher and the best video of getter and setter

  • @jaaferelsadig
    @jaaferelsadig 3 года назад

    Thanks a lot, read it in a few places but didn't grasp it till I saw this

  • @plazzmator
    @plazzmator 4 года назад

    best c# tutorial i have ever seen

  • @darxyde
    @darxyde 5 лет назад +1

    Well explained, I finally know what's the deal with get/set ... Thanks!

  • @PP-mh5ne
    @PP-mh5ne 6 лет назад

    Fantastic guide, had some trouble understanding this, but could follow your explanation perfectly on the first attempt!

  • @wilmsg3875
    @wilmsg3875 4 года назад +2

    This guy is a legend. clear and concise content without beating about the bush #amazing

  • @AlexCio
    @AlexCio 4 года назад +1

    Thanks for this great introduction!
    I am still new to c-sharp and I am use to create getters and setters differently from java :)

  • @kruth6663
    @kruth6663 3 года назад +1

    Mike makes it so easy to understand, thank you so much.
    I would like to see a Dog rated movie 😂

  • @TheMisiekMisiek
    @TheMisiekMisiek 2 года назад

    Really good. I like it very much. Clear explanation.

  • @jeffreyhicks6380
    @jeffreyhicks6380 3 года назад

    I'm always thankful for your content! Thank you, Mike Dane!

  • @mathieuseligmann9488
    @mathieuseligmann9488 3 года назад

    Thank you very much. I have been watching a few times and I did some sketches and took note. I think that is super clear. Thanks a lot

  • @ExiledExia
    @ExiledExia 4 года назад

    this explained it better than 3 weeks of programming class

  • @dhyangandhi4344
    @dhyangandhi4344 4 года назад +1

    Love your content...very easy to understand, and interesting.
    Thanks a lot

  • @mithusrpgteam
    @mithusrpgteam 6 лет назад +2

    Thank you! You made me understand those.
    Have a nice day!

  • @Соёл-ЭрдэнэСАМБАЛХҮНДЭВ

    This man is a national treasure

  • @CuteRay
    @CuteRay 3 года назад +2

    8:26 if value is equal to POG
    PS thank you this helped me

  • @destinynguyen3721
    @destinynguyen3721 2 года назад

    I have learn a lot lesson from you, Thanks!

  • @sfz119
    @sfz119 Месяц назад

    This video deserves more Likes!

  • @dominiquedevries9972
    @dominiquedevries9972 4 года назад

    Everything you do is for free, so I donate 10 euros via your site. Please keep up the good work :)

  • @KJ_GamingYTopG
    @KJ_GamingYTopG Год назад

    You are helping me in my class. I just cannot understand what the teacher is talking about. I feel stupid...you make me feel like there is some hope i will pass this class!!

  • @Theodore2303
    @Theodore2303 2 года назад

    This the gem. Thank you man!

  • @hamitatalar447
    @hamitatalar447 4 года назад

    I'm watching your video from turkey.You are very good

  • @michealoguntola702
    @michealoguntola702 2 года назад +1

    @Mike Dane thanks for the awesome explanation. Can you please create tutorial on lambda expressions in C#? Thanks

  • @sagnikchakraborty4750
    @sagnikchakraborty4750 3 года назад

    Best Teacher ❤️❤️❤️

  • @devonk298
    @devonk298 4 года назад

    Nice ty! Would love to see a full course on OOP from you!

  • @Patricebrouh
    @Patricebrouh 5 лет назад

    Great! I understand "set" and "get" thanks to this video

  • @vijayarajan-bt5fk
    @vijayarajan-bt5fk 5 месяцев назад

    அருமை, வாழ்த்துகள்;

  • @bhattbhaumik3266
    @bhattbhaumik3266 2 года назад

    Awesome
    Clear and concise

  • @ame7272
    @ame7272 3 года назад

    Your tutorials are awesome. Thank you!

  • @mmabasa26
    @mmabasa26 Год назад

    BEST EXPLAINER!

  • @stevenerixon33
    @stevenerixon33 4 года назад +1

    super helpful! Thanks!
    you're really talented at explaining :D

  • @DylanKeyter
    @DylanKeyter 5 лет назад

    Fantastic explanation dude, you are extremely good at what you do. Thank you.

  • @shaunhunterit342
    @shaunhunterit342 2 года назад

    Thanks, a very clear explanation

  • @AliTahreiSh
    @AliTahreiSh 2 года назад

    Simple and comprehensive

  • @kanuraagkaushik97
    @kanuraagkaushik97 6 лет назад

    Good flow and a better explanation.

  • @guvencelikhalat6409
    @guvencelikhalat6409 6 лет назад

    Great Job . Thank You. Keep on your work. May God Be With You.

  • @rohitpandrangi8537
    @rohitpandrangi8537 3 года назад

    bro this video is so cool... thanks for explaining it so clearly

  • @fahadmdkamal530
    @fahadmdkamal530 6 лет назад

    At last I've understand the main reason of using getters and setters. Thanks will not be enough for you... But thank you a lot.

  • @monkeyrobotsinc.9875
    @monkeyrobotsinc.9875 4 года назад +1

    I like that it rhymes

  • @musabchishti8476
    @musabchishti8476 11 месяцев назад

    Thankyou so much to clear the concepts😇

  • @sybildong9608
    @sybildong9608 4 года назад

    it really helps me on my assignment!! thanks!

  • @tsareena5899
    @tsareena5899 4 года назад +1

    I'm about to finish all these videos from the freeCodeCamp compilation. The best free tutorials out there! I just hope there's more for C# moving to the intermediate something like that and then advance.

  • @thefunnybuddy4138
    @thefunnybuddy4138 5 лет назад +16

    7:15 Damn dude, why your program always yelling at you?

  • @mehrdad_ranj
    @mehrdad_ranj 3 года назад

    that was awesome Mike , thanks

  • @xdzax5417
    @xdzax5417 4 года назад

    Thank you Mike you've made a nice video thanks again.

  • @pedrobelluzzo
    @pedrobelluzzo 4 года назад

    Using getters and setters to include rules for managing attributes make sense to me. Untill today, i just tought "if an attribute is private, why the heck other classes would have access to them via getters and setters?". I can be wrong, but i think that i have seen already a O.O. clean code guide which says that you can't use them because it wouldn't make much sense, but this seems fine to me.

  • @harshbarj
    @harshbarj 4 года назад

    You know, when I first started c# I thought getters and setters were dumb. I come from a mostly Qbasic background, with a little c++ / PHP mixed in. But now after making a few programs in c# for unity I can see how this would be real handy. When working with say an inventory system you may only want some items to have certain values. sure you can technically do that without the getters and setters, but it's not as secure. So if you only want an item to stack to 64 you can simply enforce that limit here. Sure the player might lose an item, but that's better than allowing cheating. If players start losing items, it's time to check your code!

  • @alexgann4585
    @alexgann4585 2 года назад

    This helped a lot, thanks so much!

  • @PovilasCiplis
    @PovilasCiplis 4 года назад

    thanks for a good tutorial Mike

  • @simonroyjonesuk
    @simonroyjonesuk 3 года назад

    Thanks. Really useful and clear.

  • @waqar8544
    @waqar8544 4 года назад

    Thanks you cleared my concept.....

  • @roadstermane
    @roadstermane Год назад

    You are my savior ❤❤❤

  • @o.429
    @o.429 6 лет назад

    Very very simple and helpful comment.

  • @carol00210
    @carol00210 2 года назад

    What an amazing tutorial, thank you so much

  • @MrPoselsky
    @MrPoselsky 5 лет назад +1

    YOU DESERVE MY SUB! THANK YOU!

  • @mikedudok9215
    @mikedudok9215 2 года назад

    Very helpfull video thanks!

  • @binjozoken6055
    @binjozoken6055 2 года назад

    Wow! Great stuff.

  • @mirlamontano6640
    @mirlamontano6640 6 лет назад

    Amazing explanation, it was very useful!!

  • @relaxandgetenergy7182
    @relaxandgetenergy7182 2 года назад

    Very clear. Thank you sir :)

  • @redcrafterlppa303
    @redcrafterlppa303 3 года назад

    It explained getters and setters nicely, but the example would have called for an enum.

  • @gameplayhubindia
    @gameplayhubindia 5 лет назад

    Could you please give one example on boolean property... It's gonna be very helpful for me 😊

  • @dominiquedevries9972
    @dominiquedevries9972 4 года назад

    You are amazing!

  • @hvyonezsolid-ground1119
    @hvyonezsolid-ground1119 4 года назад

    Question, does .net core allow you to use the input validation setter as in your example. I had to use a separate method for validation and then set the setter valve... Kept throwing an exception trying to validate within the setter block???

  • @david-thang-coder
    @david-thang-coder 3 года назад

    Thanks Mike