声明VB.NET中的一个十六进制常数 [英] Declaring a hex constant in VB.NET
问题描述
我如何转换下面的C#十六进制到 VB.NET 十六进制?
私人常量UInt32的TEMP = 0xE6359A60;
我试过以下,但它不工作。
公共常量临时作为System.UInt32 = 0xE6359A60
C#使用 0X
和 VB.NET 使用&放大器; H
并指定十六进制数前缀
试试这个。 p>
公共常量温度为整数=&放大器; HE6359A60
子主要
端子
和它可能是为UINT也:
公共常量临时作为UInt32的=安培; HE6359A60UI
子主要
端子
检查MSDN的类型的字符(Visual Basic)中定义的十六进制和八进制文字文档:
编译器通常串讲文字是在$一个整数b $ b十进制(基数为10)数字系统。您可以强制文字以
的整数十六进制(基数为16)与&放大器; H前缀,然后可以将其强制
是< STRONG>八进制(基数8)与&放大器;Ø前缀。 。后面的
前缀数字必须是适当的数字系统
块引用>
参考文献:
- 的 十六进制数(不ASCII十六进制值)在VB.NET字符串(堆栈溢出)的
- 的 &是什么放; H57代表以及如何我能为C#的翻译呢?(堆栈溢出)的
How can I convert the following C# hexadecimal into a VB.NET hexadecimal?
private const UInt32 temp = 0xE6359A60;
I tried the following, but it doesn't work.
Public Const temp As System.UInt32 = 0xE6359A60
解决方案C# uses
0x
and VB.NET uses&H
as the prefix to specify hexadecimal numbers. try this.Public Const temp As Integer = &HE6359A60 Sub Main End Sub
And it could be as Uint also:
Public Const temp As UInt32 = &HE6359A60UI Sub Main End Sub
Check MSDN's Type Characters (Visual Basic) documentation for defining hexadecimal and octal literals:
The compiler normally construes an integer literal to be in the decimal (base 10) number system. You can force an integer literal to be hexadecimal (base 16) with the &H prefix, and you can force it to be octal (base 8) with the &O prefix. The digits that follow the prefix must be appropriate for the number system.
References:
- Hex number (not ASCII hex value) to string in VB.NET (Stack Overflow)
- What does &H57 represent and how can I translate it for C#? (Stack Overflow)
这篇关于声明VB.NET中的一个十六进制常数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!