0

Is struct value type or reference type?

I read in document struct is a value type.But i also can use struct class with new keyword and without new operator. I reall dont understand it is value type or reference type. Thanks for help

8th Apr 2019, 8:53 PM
gok han
gok han - avatar
2 Answers
+ 2
Anything with new is reference type because it lives on heap not the stack (Google stack vs heap and new keyword)... Variable with struct type is value unless new is used or regular pointer of type struct is used
8th Apr 2019, 8:55 PM
Elva
Elva - avatar
+ 1
Ok i will Google and look it more
9th Apr 2019, 5:50 AM
gok han
gok han - avatar