-
Notifications
You must be signed in to change notification settings - Fork 424
ArrayList in .Net standard 2.0 #296
Comments
Kind of.
It's exactly the same reason. Backwards compatibility is still important in .Net Standard (and is especially a focus in .Net Standard 2.0). And considering that |
Wouldn't it be better to educate people not using it? What does it offer that other collection don't have? Redundancy is an anti-pattern since you have to maintain twice the amount of code. I'm fine to have it as a plugin/extension but not as a first-class citizen of the standard. I doesn't make sense. Or do you really want to have to deal with obsolete legacy code 20 years from now? All legacy should go into a separate assembly with the goal of being removed ASAP. Otherwise you end up slowing down the adoption of new standard, pretty much like IPv6 which was supposed to replace IPv4 almost 20 years ago (1998)!! |
1 similar comment
Wouldn't it be better to educate people not using it? What does it offer that other collection don't have? Redundancy is an anti-pattern since you have to maintain twice the amount of code. I'm fine to have it as a plugin/extension but not as a first-class citizen of the standard. I doesn't make sense. Or do you really want to have to deal with obsolete legacy code 20 years from now? All legacy should go into a separate assembly with the goal of being removed ASAP. Otherwise you end up slowing down the adoption of new standard, pretty much like IPv6 which was supposed to replace IPv4 almost 20 years ago (1998)!! |
|
Does those apps and Nuget packages target .net 4.6.1+ or even .net 4.5+? |
We are not going to exclude non-generic collections. In .NET Core v1 we've tried very hard to keep non-generic collections out; but even there we always had it as an optional component for backwards compat. It was a constant battle to keep ABI compatibility of higher-level components (such as networking), which started in the V1 timeframe and used collections that wrap (or sit on top of) the non-generic collections. Since we had to add a ton of APIs back, even more stuff is depending on it somewhere now. Excluding the API for cleanliness adds very little value:
If you have to port existing code, it's quite tedious and error prone to rewrite usages from |
They do. They cause a lot of unnecessary allocations when used with value types. They need casting when accessing elements. They are not compatible with Linq until you use
Maybe because you were only talking to experienced and seasoned developers. There is actually a lot of confusion for new developers and/or people moving from other language such as Java. At least mark them as obsolete so that even new comers will know not to use them.
You don't need to port application that already use them. Firstly, those applications are already not compatible with .Net standard as it is today (.Net standard 1.6 doesn't support those collections). Secondly, even if those applications/libraries want to be ported to .Net standard they could still references an assembly that has those types, that is compatible with .Net standard but is not included in the standard. This could be a nuget package. There is no need to have it in the standard. |
I think what @terrajobst meant is that they don't cause bloat when you don't use them. In other words, if you don't use them, then the fact that they exist won't really affect you. Nobody is disputing that the collections have performance and other issues and that you shouldn't use them in new code.
There is a proposal to create a
It does. You just have to reference the
Do you think it's appropriate to make for example
A new implementation could just copy them from corefx. I don't see how does that hurt creating a new .Net Standard implementation. |
That's indeed what I meant.
That's what I said above. We can't let non-generic collection sit on top because other APIs in .NET Standard depend on it in API or implementation.
I don't think anybody in their right mind would implement the standard from scratch. New .NET stacks are built by forking an existing stack (such as .NET Core or Mono). That's what, for example, Tizen and Unity have done. |
Hello,
After a question by a customer about the lack of support for
ArrayList
in the current PCL profiles and standard (which in my opinion was a good thing), I was actually surprised to see that this collection type was making a comeback in version 2.0 of the standard.So I got me wondering, what is the rationale of forcing all implementation of the standard to have this deprecated API, especially considering the intrinsic performance issues it has and the fact that it offers no advantage over
List<t>
(or evenList<object>
) . Keeping it on Desktop version would make sense for backward compatibility reason (although arguably old code still targeting .Net 1.0 or 1.1 should probably disappear or be ported to a newer version), but for other platforms I really don't see the point.The text was updated successfully, but these errors were encountered: