Search code examples
c#.netarraysdynamic-arraysilist

Did microsoft drop "Dynamic" & "Static" wording from Arrays in C#?


After so many years, today I decided to look back into some complicated syntax related to arrays and didn't take much time until I realized Microsoft doesn't mention to Dynamic side of Arrays anymore and all the examples are Static. I literally needed to do a quick search to find out that they moved the concept under a new wording as ArrayList Classes or the more generic lists as List Classes

I just want to clarify this change and the fact that if I need to use the new naming to communicate with our new programmers since they might not being taught the old naming conventions in the university or online courses.

MSDN Reference

ArrayList Class (.NET Framework 4.5)

Implements the IList interface using an array whose size is dynamically increased as required.

  // Creates and initializes a new ArrayList.
  ArrayList myAL = new ArrayList();

and List<T> as

  // Create a list of parts.
  List<Part> parts = new List<Part>();

Please read this before you go ahead. What I am asking is: If Microsoft dropped the WORDING from it's glossaries of WORDS relating to Arrays or any Objects of strongly typed lists as called "Dynamic Arrays".


Solution

  • Yes, and ArrayList is effectively "dropped" as well (even though it still exists). The page you linked about ArrayList states:

    For a strongly-typed alternative to ArrayList, consider using List<T>.

    And that's exactly what you should do. Generics (introduced in .NET 2.0) were intended to fix the problems with having a bunch of weakly-typed ArrayLists everywhere. Use List<T> (or another generic collection) when you need a dynamically sized collection of items.