Data Structures and Algorithms
with Object-Oriented Design Patterns in C# |
While the C# programming language does indeed provide built-in support for arrays, that support is not without its shortcomings: Array indices range from zero to n-1, where n is the array length and the size of an array is fixed once allocated.
One way to address these deficiencies is to define a new class with the desired functionality. We do this by defining a DynamicArray class with two fields as shown in Program . The first is an array of C# objects and the second is an int which records the lower bound for array indices.