问题描述
有人可以将以下c#代码翻译成Vb.Net吗?
byte [] myData = new byte [nFileLen ];
我试过了
Dim myData As Byte()= New Byte(nFileLen)
不编译,错误信息:
类型''byte''没有构造函数。
TIA
Hi,
Can somebody translate the following c# code into Vb.Net?
byte[] myData = new byte[nFileLen];
I tried
Dim myData As Byte() = New Byte(nFileLen)
Does not compile , with error message:
Type ''byte'' has no constructors.
TIA
推荐答案
我会选择alejandro发布的解决方案。但是,您可以使上面的
代码稍作改动:
\\\
Dim FileLen As Integer = 22
Dim MyData1 As Byte()= New Byte(FileLen - 1){}
Dim MyData3()By Byte = New Byte(FileLen - 1) {}
Dim MyData4(FileLen - 1)As Byte
///
-
MS Herfried K. Wagner
MVP< URL:http://dotnet.mvps.org/>
VB< URL:http:// dotnet .mvps.org / dotnet / faqs />
I would choose the solution posted by alejandro. However, you can make the
code above work with a little change:
\\\
Dim FileLen As Integer = 22
Dim MyData1 As Byte() = New Byte(FileLen - 1) {}
Dim MyData3() As Byte = New Byte(FileLen - 1) {}
Dim MyData4(FileLen - 1) As Byte
///
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
我会选择alejandro发布的解决方案。但是,您可以稍微改变上面的代码:
\\\
Dim FileLen As Integer = 22
Dim MyData1 As Byte ()=新字节(FileLen - 1){}
Dim MyData3()As Byte = New Byte(FileLen - 1){}
Dim MyData4(FileLen - 1)As Byte
/ //
- MS Herfried K. Wagner
MVP< URL:http://dotnet.mvps.org/>
VB< URL :http://dotnet.mvps.org/dotnet/faqs/>
I would choose the solution posted by alejandro. However, you can make the
code above work with a little change:
\\\
Dim FileLen As Integer = 22
Dim MyData1 As Byte() = New Byte(FileLen - 1) {}
Dim MyData3() As Byte = New Byte(FileLen - 1) {}
Dim MyData4(FileLen - 1) As Byte
///
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
这篇关于newbee需要帮助代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!