C# Value Types vs. Reference Types

preview_player
Показать описание
Jamie King showing the difference between a value type and a reference type in C#.
Рекомендации по теме
Комментарии
Автор

never seen such easy explaining of value and ref types before, god bless you :)

osamaahmed
Автор

You should add more videos on C#, Your videos are very helpful.

pragmatic-pr
Автор

Very clear and informational video; really established the facts for me.

rubenschenkhuizen
Автор

JATR1X Its been over a year now but i am going to type this out anyways. The new keyword when used upon value types creates a new constructor. In C# land there is a default constructor and a constructor. A default constructor takes no parameters. Well obviously you cannot create a constructor that takes no parameters in a struct but that is not the point of the default constructor. You don't explicitly create a default constructor, the C# compiler creates one for you *ONLY IF YOU DO NOT HAVE A CONSTRUCTOR INSIDE YOUR STRUCT* the default constructor will set all fields to their default values if you use just a constructor you will have to initialize the fields inside the constructor.

wasiimo
Автор

very good explanation. at last i understood what s happening in memory with value types.

radiator
Автор

Thanks for a great video man! Both informative and fun! Just the way I like it!

markusjohansson
Автор

Very good explanation, clear and informative.

tigranminasyan
Автор

I just came for value vs reference but also learned about strut which was confusing me. Cheers!

santosclausios
Автор

This is an important video for some people, because C# syntax looks so similar to C++, yet here the semantics are totally different. Instead of struct and class being different solely in that struct members default to public and class members default to private, and that only because of backwards compatibility with C (Stroustrop would have preferred to get rid of the struct keyword entirely if he could have) -- and with both structs and classes being able to be instantiated on the stack, in static memory, or on the heap...we have the struct keyword meaning "Hey, this is a new value type, new them on the stack"....


again, syntactically so similar, semantically so different. Like, wow, man.

jvsnyc
Автор

Thanks!! Will string act the same way as class then?

marijkemeersman
Автор

if the new keyword (when used upon reference type) is allocating memory on the heap, what does new keyword do when it is used upon value type?

JATRX
Автор

very easy video to follow. Thanks! Hey, what video editing tool do you use?

pazzuto
Автор

Holy shit thank you. Coming from c++ and I was confused.

wadablewads
Автор

What is the difference between: Fraction fract2 => fract1

And

Fraction fract2 = fract1

chefbennyj
Автор

Why doesn't 555 make sense? I love that number!

tirusbrown