Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/csharp-4.0/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.net 如何快速加入此阵列?_.net_Arrays_Vb.net - Fatal编程技术网

.net 如何快速加入此阵列?

.net 如何快速加入此阵列?,.net,arrays,vb.net,.net,Arrays,Vb.net,如何快速加入此阵列?: Dim NewArray As Array = {"a", "b", "c"} MsgBox(String.Join(vbNewLine, NewArray)) ' Result: System.String[] 问题是我无法在加入时打印数组的内容,请参阅代码上的“result”注释 谢谢。那是最快的方法。有什么问题吗 尝试: 听起来你想要的是这样的东西 Dim NewArray As String() = {"a", "b", "c"} MsgBox(String.J

如何快速加入此阵列?:

Dim NewArray As Array = {"a", "b", "c"}
MsgBox(String.Join(vbNewLine, NewArray)) ' Result: System.String[]
问题是我无法在加入时打印数组的内容,请参阅代码上的“result”注释


谢谢。

那是最快的方法。有什么问题吗

尝试:


听起来你想要的是这样的东西

Dim NewArray As String() = {"a", "b", "c"}
MsgBox(String.Join(vbNewLine, NewArray)) ' Result: a b c
或者,使用Linq的扩展方法,该方法可用于任何非泛型的
IEnumerable
,包括
数组
类型:

Dim NewArray As Array = {"a", "b", "c"}
MsgBox(String.Join(",", NewArray.Cast(Of String))) ' Result: a b c

是的,很抱歉,也许我没有提出一个好问题,问题是我加入时无法打印数组的内容,请查看代码上的注释行。回答问题duh。+1 VB.Net不是我的主要语言,但似乎这个解决方案和我的一样好。是的,这正是我需要的(嗯,换行符代替空格,但是的)@pitoloko是的,每个条目之间都会有新行,我只想在一行上发表评论。但我需要使用我的问题中所示的数组类型,而不是数组(字符串)类型。如果有帮助,请参见我的新问题,再次感谢:
Dim NewArray As Array = {"a", "b", "c"}
MsgBox(String.Join(",", NewArray.Cast(Of String))) ' Result: a b c