我来自 C# 背景,现在必须在 VB.Net 中编码(新工作)
我正在 VB.Net 中编写代码,该代码在 C# 中运行良好(在语法更改后),但在 VB.Net 中它给出了Array bounds cannot appear in type specifiers
.
C# 代码
TimeSpan yesterday = new TimeSpan(1, 19, 0);
DateTime today = new DateTime(2012, 9, 4, 8, 48, 0);
DateTime ts = today.Add(new TimeSpan(9, 0, 0)).Subtract(yesterday);
VB.Net代码
Dim yesterday As New TimeSpan(1, 19, 0)
Dim today As New DateTime(2012, 9, 4, 8, 48, 0)
Dim ts As today.Add(New TimeSpan(9, 0, 0)).Subtract(yesterday)
它在 VB 代码的第 3 行给出了这个错误New
。我哪里错了?