Skip to main content

Timeline for C#'s Aversion to Array

Current License: CC BY-SA 4.0

9 events
when toggle format what by license comment
Jul 2 at 12:52 audit First answers
Jul 2 at 12:53
Jul 2 at 6:08 comment added JacquesB @K0D4: I have expanded on the example to show it is a general issue for arrays, not just something specific to object[]. Any time you have an array where the element type supports subtyping, you have this potential issue. The issue also affect interface subtyping.
Jun 26 at 16:15 history edited JacquesB CC BY-SA 4.0
added 734 characters in body
Jun 25 at 20:57 comment added K0D4 Using a collection of object type seems too academic to be a real argument. Nobody in their right mind would actually write code that way (or at least, would choose it as the first option), when you have access to interfaces and compositional classing.
Jun 24 at 22:18 comment added Eric Lippert @dbc: That was the idea, yes. The restrictions on how a span can be created and stored gives you most of the speed advantages of pointers while still maintaining a reasonable amount of type safety and memory safety.
Jun 24 at 20:40 comment added dbc @EricLippert - Span<T> and Memory<T> don't have this anti-feature. So are they actually faster to work with than arrays, even when they are created from arrays?
Jun 24 at 15:46 comment added Eric Lippert C# has unsafe array covariance because the .NET runtime does, and the .NET runtime has it because the designers of the runtime wanted it to be suitable for an implementation of Java, and Java has this dumb feature. It's one of the worst features of C#, in that it makes your programs both less robust and slower at the same time.
Jun 24 at 6:55 history edited JacquesB CC BY-SA 4.0
added 659 characters in body
Jun 23 at 13:50 history answered JacquesB CC BY-SA 4.0