Some questions about .NET Framework design decisions

From: SpookyET (not4_u_at_hotmail.com)
Date: 04/04/04


Date: Sun, 04 Apr 2004 13:27:45 -0400

I've been wondering about some of the decisions that were made about the
.net framework:

- Why are arrays not dynamic, where you can decrease/increase the size of
the array without creating a new one, then copy the values from the old
one into the new one, and destroying the old one, which is what ArrayList
does. This will kill the need for a Linked-List (which currently is not
in the System.Collections name-space). Sometimes you may care more about
the amount of memory used than the speed of allocating a new node in the
list. Also, a linked list does not have the problem of array
fragmentation, which happens when you remove items from the middle of the
array.

- Why are strings immutable? Why not have String and StringBuilder united
in one class under the name String?

- Why weren't generics available in the v1.0 of the framework? It is very
annoying to have to create your own collections because you don't want to
slow your application down because of type casting to and from object.
When you want a collection that accepts any type, it makes sense to use
the base class of all objects, but most of the time you want a collection
of only one type of objects. You have CollectionBase for strongly typed
collections, but that still is using casting to and from object.

That is it for now. I've been using C# since 2002, yet I have had this
questions on the back of me mind for a long time.



Relevant Pages

  • Help in French|Spanish|German translation.
    ... I am also an author of User-defined string functions. ... WORDTRANEX (cSearched, cArExpressionSought | cExpressionSough, ... each string of the array is searched ... If the parameter nArStartOccurrence is -1 or omitted, the replacement starts ...
    (microsoft.public.fox.helpwanted)
  • Re: passing a string to a dll
    ... Joe, I really appreciate you taking the time to demonstrate this. ... sure how I would implement indexing it for random alphanumeric codes. ... I might handle the array. ... I actually have been wondering if I could use a second string ...
    (microsoft.public.vc.mfc)
  • Re: passing a string to a dll
    ... I might handle the array. ... I actually have been wondering if I could use a second string ... look at insertion cost, organization cost, and search cost. ...
    (microsoft.public.vc.mfc)
  • Re: Array Type Mismatch
    ... Dim resultAs String ... I am still somewhat confused as to why nothing is stored in the array. ... Public Function TextBoxGetLine(....arguments... ...
    (microsoft.public.access.formscoding)
  • Re: NumberFormatException:please help me......!!!
    ... Record that has string and array of double as members) and file could ... follows it on a line of the input file, you could use the String as a key to ... contain String representations of doubles. ...
    (comp.lang.java.programmer)