3 ms·
Except it is true because structs are often frowned on, and plenty of things end up as reference types. And arrays are reference types too, so things like strin
by MichaelGG 12y ago
Except it is true because structs are often frowned on, and plenty of things end up as reference types. And arrays are reference types too, so things like string.split have no workaround. Also note that until v4 or so, the CLR had limitations optimizing methods using structs.
But yes, the CLR has a far superior design and can avoid some of Java's pitfalls.
- eropple 12y agoStructs are frowned upon? Since when?
- pmcg 12y agoAnyone writing Minecraft in C# would use a struct for the position vector. There's no good reason to frown upon it in this case.
- bovermyer 12y agoIt's not C#, but here's Minecraft in C++ and Lua: https://github.com/minetest/minetest https://github.com/minetest/minetest
- Arnavion 12y ago>structs are often frowned on Only in the premature optimization sense, and "familiarity with new programmers" sense. There's nothing wrong with using structs. In fact, XNA and many other game programming libraries do use structs to represent position vectors, which is the context of this article. >And arrays are reference types too, so things like string.split have no workaround. If you're okay with going unsafe, arrays can be stackalloc'd.
- Locke1689 12y agoThis is a cultural problem. We use structs all over the place in Roslyn. You need to train your developers on how to appropriately use the features available to them on the platform.