문제

So this question I am working on ask you to code a simple statement that was Base-16 followed by a newline character. And use Dim someValue As Integer = 346 to work with. Would this be correct [see code]? I am not sure if I understand decimal in VB all that well... Because looks like this "0000000000000346".

Module Module1

    Sub Main()
        Dim someValue As Integer = 346
        Console.WriteLine("{0:D16}" + vbNewLine, someValue)
    End Sub
End Module

Sorry if my question is not clear.

도움이 되었습니까?

해결책

The Convert.ToString() function has a useful overload which will generate a string representation of a number in some different bases:

Dim someValue As Integer = 346
Console.WriteLine(Convert.ToString(someValue, 16) & vbNewLine)
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top