When we create an array in C# , we tend to define the size of the array as shown below.
String[] strArray = new String[5];
Can we create an array without defining the size ?
The best option in this scenario is to use the collection. You can use the Generic List which allows you to add as many items as possible and then you can use the ToArray method to convert to an array.
var lstrray = new List<string>(); string[] strArray = lstrray.ToArray();
Leave a Reply