看看下面的代码。,
C#
string[] testString = new string[jobs.Count];
等效的 VB.Net
Dim testString() As String = New String(jobs.Count - 1) {}
为什么在创建新数组时在 vb.net 中使用“jobs.Count - 1”而不是“jobs.Count”?
最佳答案
在 VB.NET 中,数组声明中的数字表示“最大索引”,但在 C# 中表示“元素数”
关于c# - C# 和 VB.Net 中数组的起始索引,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15875681/