I want to put some information that I am reading off an Excel Workbook into a 1-dimensional array of strings.
How do I initialize this array as a Dynamic 1-dimensional array of strings.
I have tried using the New List(Of String()) method but I get the following error: “ERROR Compiler error(s) encountered processing expression “New list(of String())”.
Value of type ‘System.Collections.Generic.List(Of String())’ cannot be converted to ‘1-dimensional array of String’.”
basically Array is of fixed size, when you say dynamic array then you can use List which is a collection which allows adding and removing items from the collection.
So to initialize the list use —> New List(Of String) variable type should be List<String> (System.Collections.Generic.List<System.String>) As shown in below shot.