
This article shows how to create dynamic arrays in C#.Quite often you want to create a method that returns an array of a given type. In most cases you don't know the number of elements of that array up front (e.g., when returning data from the database). The problem is that when you declare an array in C#, you must specify the number of elements of that array. The following code snippet shows a declaration of an array of strings with 10 elements.
|