<p>How can I create an empty one-dimensional string array?</p>

[{'answer_id': 44720, 'author': 'ZombieSheep', 'author_id': 377, 'author_profile': 'https://Stackoverflow.com/users/377', 'pm_score': 1, 'selected': False, 'text': "<p>Not sure why you'd want to, but the C# way would be</p>\n\n<pre><code>string[] newArray = new string[0];\n</code></pre>\n\n<p>I'm guessing that VB won't be too dissimilar to this.</p>\n\n<p>If you're building an empty array so you can populate it with values later, you really should consider using </p>\n\n<pre><code>List&lt;string&gt;\n</code></pre>\n\n<p>and converting it to an array (if you really need it as an array) with </p>\n\n<pre><code>newListOfString.ToArray();\n</code></pre>\n"}, {'answer_id': 44725, 'author': 'Chris Zwiryk', 'author_id': 734, 'author_profile': 'https://Stackoverflow.com/users/734', 'pm_score': 3, 'selected': False, 'text': '<p>Something like:</p>\n\n<pre><code>Dim myArray(9) as String\n</code></pre>\n\n<p>Would give you an array of 10 String references (each pointing to Nothing).</p>\n\n<p>If you\'re not sure of the size at declaration time, you can declare a String array like this:</p>\n\n<pre><code>Dim myArray() as String\n</code></pre>\n\n<p>And then you can point it at a properly-sized array of Strings later:</p>\n\n<pre><code>ReDim myArray(9) as String\n</code></pre>\n\n<p>ZombieSheep is right about using a List if you don\'t know the total size and you need to dynamically populate it. In VB.NET that would be:</p>\n\n<pre><code>Dim myList as New List(Of String)\nmyList.Add("foo")\nmyList.Add("bar")\n</code></pre>\n\n<p>And then to get an array from that List:</p>\n\n<pre><code>myList.ToArray()\n</code></pre>\n\n<p>@Mark</p>\n\n<p>Thanks for the correction.</p>\n'}, {'answer_id': 44728, 'author': 'G8RDA', 'author_id': 4609, 'author_profile': 'https://Stackoverflow.com/users/4609', 'pm_score': 6, 'selected': True, 'text': '<p>Dim strEmpty(-1) As String</p>\n'}, {'answer_id': 44827, 'author': 'Joel Coehoorn', 'author_id': 3043, 'author_profile': 'https://Stackoverflow.com/users/3043', 'pm_score': 3, 'selected': False, 'text': "<p>The array you created by <code>Dim s(0) As String</code> <strong>IS NOT EMPTY</strong></p>\n\n<p>In VB.Net, the subscript you use in the array is index of the last element.  VB.Net by default starts indexing at 0, so you have an array that already has one element.</p>\n\n<p>You should instead try using <code>System.Collections.Specialized.StringCollection</code> or (even better) <code>System.Collections.Generic.List(Of String)</code>. They amount to pretty much the same thing as an array of string, except they're loads better for adding and removing items.  And let's be honest:  you'll rarely create an <em>empty</em> string array without wanting to add <em>at least</em> one element to it.</p>\n\n<p>If you really want an empty string array, declare it like this:</p>\n\n<pre><code>Dim s As String()\n</code></pre>\n\n<p>or</p>\n\n<pre><code>Dim t() As String\n</code></pre>\n"}, {'answer_id': 44830, 'author': 'Mark Brackett', 'author_id': 2199, 'author_profile': 'https://Stackoverflow.com/users/2199', 'pm_score': 6, 'selected': False, 'text': '<p>VB is <a href="http://msdn.microsoft.com/en-us/library/02e7z943(VS.80).aspx" rel="noreferrer">0-indexed in array declarations</a>, so seomthing like <code>Dim myArray(10) as String</code> gives you <strong>11</strong> elements. It\'s a common mistake when translating from C languages.</p>\n\n<p>So, for an empty array, either of the following would work:</p>\n\n<pre><code>Dim str(-1) as String \' -1 + 1 = 0, so this has 0 elements\nDim str() as String = New String() { } \' implicit size, initialized to empty\n</code></pre>\n'}, {'answer_id': 26910445, 'author': 'Michael Johnson', 'author_id': 3596159, 'author_profile': 'https://Stackoverflow.com/users/3596159', 'pm_score': 2, 'selected': False, 'text': '<p>Another way of doing this:</p>\n\n<pre><code>Dim strings() As String = {}\n</code></pre>\n\n<p>Testing that it is an empty string array:</p>\n\n<pre><code>MessageBox.Show("count: " + strings.Count.ToString)\n</code></pre>\n\n<p>Will show a message box saying "count: 0".</p>\n'}, {'answer_id': 28195263, 'author': 'JustinMichel', 'author_id': 1469095, 'author_profile': 'https://Stackoverflow.com/users/1469095', 'pm_score': 3, 'selected': False, 'text': "<p>You don't have to include String twice, and you don't have to use New. <br/>\nEither of the following will work...</p>\n\n<pre><code>Dim strings() as String = {}\nDim strings as String() = {}\n</code></pre>\n"}, {'answer_id': 49795972, 'author': 'Lisa', 'author_id': 9278627, 'author_profile': 'https://Stackoverflow.com/users/9278627', 'pm_score': 0, 'selected': False, 'text': '<p>try this\nDim Arraystr() as String ={}</p>\n'}, {'answer_id': 51678152, 'author': 'Scott Mitchell', 'author_id': 2657744, 'author_profile': 'https://Stackoverflow.com/users/2657744', 'pm_score': 2, 'selected': False, 'text': '<p>A little verbose, but self documenting...</p>\n\n<pre><code>Dim strEmpty() As String = Enumerable.Empty(Of String).ToArray\n</code></pre>\n'}, {'answer_id': 59310889, 'author': 'Dennis Spade', 'author_id': 9128501, 'author_profile': 'https://Stackoverflow.com/users/9128501', 'pm_score': 1, 'selected': False, 'text': '<p>Dim array As String() = Array.Empty(Of String)</p>\n'}]
['https://Stackoverflow.com/questions/44713', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3821/']