Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

In the context of C# this becomes a real pain.

The isuee are arrays/lists.

Because in C# an int[] array or List<int> is a reference.

So even if you put a int[] in a struct this int[] will NOT be copied when you assign an instance of this struct to another instance: you will get a reference share which makes this annoying since you cannot do a proper deep copy with the language itself: you are forced to use reference copy instead of deep copy.

In C++ this is easy because the types differentiate between pointer and non-pointer explicitly + you can overload the assignment operator.






Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: