C#: The Heap and the Stack
Vložit
- čas přidán 4. 03. 2018
- When programming in C#, it is very important to understand the concept of the heap and the stack. Value types such as integers are stored on the stack. Object types are stored on the heap, with pointers to them stored on the stack. This video explains the heap and the stack with an example and a diagram and demonstrates the dangers that await you if you do not understand this concept.
so far the easiest explanation of stack and heap ive seen
I've been programming with c# for 2-ish years. I had a solid understanding of certain types being passed by reference instead of value, but never learned what the Heap or Stack *actually* were. This video finally made it click in my head. I'm glad I wasn't missing out on much and just learned some new names for stuff I already kinda knew :]
For anyone watching: You can pass value types by reference, by simply prefixing the type in the parameters with a "ref" keyword. Also look up the "out" keyword
This is amazing, great job man. This taught me something very valuable that I was completely unaware of before. Not sure why this wasn't properly explained in the books I read.
Preparing for the MTA Software Development Fundamentals exam to meet entry requirements for the WGU Data Analytics degree program. This is something that pops up on the test and has always confused me. The way you've explained it is extremely clear.
Thank you.
The best explanation I've seen... I remember being a bit confused about this behavior when first learning JavaScript and this nails it in a very clear way. Great job
Clear explanation with visual Diagram. love it.
this is awesome. You made the concept sound very simple and easy to understand. Thank You!
Very best explanation with practical example. Thanks a lot . Waiting for your next video
Great video! Thank you!
Great demonstration and explanation. Thanks 👍
Nice one
Clear explanation. Thank you for the video!!
You're such a great educator
nice and easy to understand explanation...
Thanks for the Sharing of your knowledge
This was interesting, Thank-You
king shit, you are a legend.
thanks man great job
Thank you!!
thanks you so much
excellent
thank you that was amazing explain
Finally some one
Nice
best example
Super! Subscribed! ps. would you kindly group your videos by programming language into seperate PlayLists for convinence? Thanks a million for the great contents!
4:10 No, you didn't change the value of score2
Yes, this got me to laugh as well :D
💯
why did i understand this better than what my uni prof taught me? and why am I paying thousands of dollars to the uni only to learn stuff off youtube?
dud I feel exactly the same lol
This super 👌
أسطورة
This is it
In c# by default everything passes by value, classes pass their reference as a value. That is my understanding, or I am wrong?
Can we use struct all the time?
Hey have you found the answer to your question?
@@Luizzzzzzzzzzzzzzzzzzzzzzzzzz Nope :(
@@wwg681 it's not like Struct is an alternative or replacement for Classes, they have different purposes. Depending on how simple your program is, then yeah you can use only struct, nothing will enforce you to use classes (apart from Program class e.g in a console), but depending on your needs it will just make your task harder for no good reason.
Is this useful to someones that doesnt know what the stack and the heap are?
Yes.
in the end of the video you say "int s". Was it "int score"
Great Learning Video!
Good explanation. Please lower keyboard noise
Good explanation, but it is not really about "Heap and Stack", the title should be *"Value and Reference types"*
Spassibo = true;
It's wrong. Reference type parameters are passed by value. You can test yourself by setting r = null; The pointer on "r" is removed, but "report" is still has pointer.
would be useful if you could actually see the text you're writing, how did you mess it up so badly?