0

在 c# 中,我可以这样做:

发送.Write((ushort)9);

“发送”是 BinaryWriter 的一个实例,我如何在 vb.net 中做到这一点?我试过这样:

发送.Write((UShort)9)

但我得到“UShort 是一种类型,不能用作表达式”

谢谢!

4

2 回答 2

2

这适用于所有版本的 VB.NET:

send.Write(CType(9, System.UInt16))
于 2009-08-01T15:00:33.663 回答
1

更接近的翻译是:

send.Write(ctype(9, UShort))
于 2009-08-01T15:01:01.527 回答