C#: The Heap and the Stack
ฝัง
- เผยแพร่เมื่อ 24 ก.ย. 2024
- 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.
Finally an explanations for a dummies like me! Thanks you for this, huge upvote!
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.
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
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.
this is awesome. You made the concept sound very simple and easy to understand. Thank You!
Clear explanation with visual Diagram. love it.
Very best explanation with practical example. Thanks a lot . Waiting for your next video
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
Great demonstration and explanation. Thanks 👍
nice and easy to understand explanation...
Nice one
Great video! Thank you!
4:10 No, you didn't change the value of score2
Yes, this got me to laugh as well :D
Good explanation, but it is not really about "Heap and Stack", the title should be *"Value and Reference types"*
Clear explanation. Thank you for the video!!
Super! Subscribed! ps. would you kindly group your videos by programming language into seperate PlayLists for convinence? Thanks a million for the great contents!
Thanks for the Sharing of your knowledge
You're such a great educator
king shit, you are a legend.
excellent
In c# by default everything passes by value, classes pass their reference as a value. That is my understanding, or I am wrong?
Finally some one
This was interesting, Thank-You
thank you that was amazing explain
in the end of the video you say "int s". Was it "int score"
Nice
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.
thanks you so much
Thank you!!
Is this useful to someones that doesnt know what the stack and the heap are?
Yes.
thanks man great job
best example
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.
أسطورة
This is it
Good explanation. Please lower keyboard noise
This super 👌
💯
would be useful if you could actually see the text you're writing, how did you mess it up so badly?
Spassibo = true;
Great Learning Video!