Learn C# for beginners: 42 - Pass by Reference vs Pass by Value
Вставка
- Опубліковано 13 бер 2015
- If you enjoyed this video please comment below and give me a thumbs up! It goes a long way.
If you want to keep watching these videos make sure to subscribe!
You can contact me at:
Twitter: / jdprogramming
For business Inquires please email at: JDProgramming@Outlook.com
You've earned yourself a fan with this video Jesse. Loving your work.
I'd been on the edge of despair trying and failing to understand this concept. This video saved my assignment, and me. Thank you🙏🏻
Super Helpful video was struggling understanding other videos but this one definitely is the one and only one to watch.
I have studied this many times but this is the first explanation I have received that is dumbed down enough for me to understand better than before. Thanks!
Maybe it wasn't dumbed down, maybe it was just explained well.
Thanks Jesse. I’ve been writing C# for years and needlessly making the return type of the function another instance of the type. Simple yet important info.
Rather than a whiteboard session, this drives the point home much clearly as to where values/references are useful and why so. thanks for your time..!!
I'm so glad I found this video and your channel! You're great at explaining things and your voice is really soothing. Thank you so much for teaching us noobs :D
Thank you very much, left a like because it's a good video
You are a great explainer. I hope you know that.
awesome!!!!! you wroth a subscription!!!!! pass by value and ref got cleared !!!! salute brother
Awesome!!! I like the way you explains!!!!
Thank you, I'm glad you liked it.
very good explained. thank you
Outstanding Superb
YOu are best teacher in the whole world..
got it thanks , i had to watch it multiple times, but when i got it ....i got it....thanks again
very good course ! probably the best in c#
very good video thanks dude
This video is fantastic
Great video. Keep it up! Subb'd.
Love the way you explain, is the next course coming any time soon? @jesse
Thanks Jesse!
Thanks! This is one of the best explanations I have seen.
I'm actually using Pluralsight to refamiliarise myself with C# and had to come here for clarification on Pass By Reference/Value. Great video, very articulately described. Now to cancel my Pluralsight subscription and follow the rest of your courses!
I'm actually planning on making a brand new c# course. I'm just trying to figure out what exactly I want to cover in it. I don't know if I should pick up where I left off in this series, or just start over. The content is pretty old, and I've learned a lot since then in teaching.
It might be more 'aesthetically pleasing' if you were using an newer version of VSCode or something and making use of some of the extensions? Apart from that I guess not a lot changes for the real fundamentals!
The core content is still relevant and your teaching flow is excellent so may I humbly suggest that there is no need to start over, but to add on.
@@JesseDietrichson your c# course on youtube is way above and beyond anything else available for free or paid . Really fantastic stuff.
@@JesseDietrichson are you still planning on doing one?
so anything with a new is a ref, so that means i can remove ref off my new list and object then...thanks
Not all objects created with new are reference types. For example structs are created with new but they are value types... I think you should correct some parts of your tutorial.
I know this is an old video, but aren't you passing the array by value as well later on in the video. From what I can understand you're passing a reference variable by value which means if you for example assign a new array to the variable inside the function then the outside array wont be changed at all but if you change the values inside the array as you did then the outside variable will be referencing the changed array as well. Basically what I'm saying is for example if you pass in an array grades with grades[0] = 50 and inside the function if you changes the grades array as grades = new int[1]{100} then when you come out of the function the value of grades[0] will still remain 50 which means you're passing a reference variable by value that is what you're passing is the value of the reference. Please correct me if I'm wrong and I'm sorry if I couldnt convey it properly. Thank You.
Also want to link this article if I totally messed up my point jonskeet.uk/csharp/parameters.html. In this what I'm talking about is under the side heading value parameters.
ariamis07 you are 100 percent correct. Everything in csharp is pass by value by default. So here we are passing a reference type by value. The reason I explained it like I did back then is just because I thought it would be easier to understand however I’ve always regretted teaching it like this and if I made this again I would change it.
Thanks for the reply, It was kind of confusing at first but I think I understand now.
So the first one didn’t work because it’s a struct, but the second one worked because it’s a class?
This is not pass by reference. You passed value of reference type, not real adress of that variable.
bojanicm you are 100 percent correct. I think when I made this video I tried to make it easy to understand by describing it that way