C# Value Types and Reference Types

preview_player
Показать описание
Coding Tutorial: In .NET, there is a fundamental division between value types and reference types. All is explained here.

(Yes, I know I wrote 'CreateOjects' not 'CreateObjects'.)

Рекомендации по теме
Комментарии
Автор

Anything other fundamental features of C# you're interested in? Let me know.
And if you liked it, click the 👍.

CodingTutorialsAreGo
Автор

Excellent excellent excellent! Learning programming becomes simple when you are lucky enough to discover such a superb explanation!! Thank you very much!!

bioanu
Автор

This is the best explanation i've heard on this topic.

alexpajp
Автор

Wow, the best explanation I have seen so far. Thx for this!

dolusdirectu
Автор

Great video. The best explanation i have ever seen on YouTube

ЕдвардГригорян-нк
Автор

Thanks a lot! That is really helpful, your explanation is clear and easy to understand!

yegorkatrechko
Автор

These are brilliant - keep up the great work and thanks for your time!

zachgh
Автор

There is a good article that you can find on real world performance that you can google. "Stack allocation vs heap allocation – performance benchmark". But any way on 1 million loops with 10 allocation+init+free attempts, we see that difference is about 8% at 60KB total processing size. Which also also not a big show stopper.

davidwhite
Автор

Love your videos. You should do a video about correctly implementing the Clone method/interface.

CuriousCyclist
Автор

Very good! And how are the p1 p2 fred (names of objects) stored? In which part of the memory?

nononnomonohjghdgdshrsrhsjgd
Автор

I like to think of passing by reference as passing by value. Instead of passing a copy of a normal value type, we pass a copy of a memory address on the heap.

Pluvofor
Автор

Another great explanation! Thank you! Also... what program did you use to create your sack pointer animation on the right side at the first half of the video?

DedicatedManagers
Автор

What will happen in Stack if we have:
var a = 5;
a = 6;

Will the compiler overrite the value of the existing variable "a" (5 to 6) OR
It will create new object "a" with value of 6?

Same question for string?

var a = "aa";
a = "bb";

Will the compiler override the reference of "a" in the Stack OR
Will create new object "a" with the newer reference?

hristoiliev
Автор

lul c# is really funny when one comes from c++ background... I was so lost.

zanagi
Автор

In Java we have Wrapper Classes to make primitive types to reference types.However in C# int is inherited from Object class.How can it is possible to both inherited and being stored in stack.What happens if I call toString() method on a int variable is it will be allocated to the heap?.I dont understand how it is possible to inherited from object if it is stored in stack it is the opposite of java.

mert.pinarbasi