P
Piotrekk
Hi
1. int is value type so it is stored on stack. class is reference type
and it is stored on heap.
What is where when we declare class which contains sturct which
contains int. I suppose that even in this example ALL value types are
on stack. Otherwise I wouldn't understand it at all since visual
studio C# project puts evertyhing into a class. Since classes are ref
types I assume that everything that is in the class and derives from
object goes to heap. Is that true?
2. How exactly compiler detects type if an object such that it can
detect wrong casts? I would appreciate also any links.
Kind regards
Piotr Kolodziej
1. int is value type so it is stored on stack. class is reference type
and it is stored on heap.
What is where when we declare class which contains sturct which
contains int. I suppose that even in this example ALL value types are
on stack. Otherwise I wouldn't understand it at all since visual
studio C# project puts evertyhing into a class. Since classes are ref
types I assume that everything that is in the class and derives from
object goes to heap. Is that true?
2. How exactly compiler detects type if an object such that it can
detect wrong casts? I would appreciate also any links.
Kind regards
Piotr Kolodziej