VB.NET Empty String Array

后端 未结 10 957
花落未央
花落未央 2021-01-07 17:56

How can I create an empty one-dimensional string array?

10条回答
  •  遥遥无期
    2021-01-07 18:29

    Not sure why you'd want to, but the C# way would be

    string[] newArray = new string[0];
    

    I'm guessing that VB won't be too dissimilar to this.

    If you're building an empty array so you can populate it with values later, you really should consider using

    List
    

    and converting it to an array (if you really need it as an array) with

    newListOfString.ToArray();
    

提交回复
热议问题