本文整理匯總了VB.NET中System.Byte.ToString方法的典型用法代碼示例。如果您正苦於以下問題:VB.NET Byte.ToString方法的具體用法?VB.NET Byte.ToString怎麽用?VB.NET Byte.ToString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Byte
的用法示例。
在下文中一共展示了Byte.ToString方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: bytes
Dim bytes() As Byte = {0, 1, 14, 168, 255}
Dim providers() As CultureInfo = {New CultureInfo("en-us"), _
New CultureInfo("fr-fr"), _
New CultureInfo("de-de"), _
New CultureInfo("es-es")}
For Each byteValue As Byte In bytes
For Each provider As CultureInfo In providers
Console.Write("{0,3} ({1}) ", byteValue.ToString(provider), provider.Name)
Next
Console.WriteLine()
Next
輸出:
0 (en-US) 0 (fr-FR) 0 (de-DE) 0 (es-ES) 1 (en-US) 1 (fr-FR) 1 (de-DE) 1 (es-ES) 14 (en-US) 14 (fr-FR) 14 (de-DE) 14 (es-ES) 168 (en-US) 168 (fr-FR) 168 (de-DE) 168 (es-ES) 255 (en-US) 255 (fr-FR) 255 (de-DE) 255 (es-ES)
示例2: providers
Dim byteValue As Byte = 250
Dim providers() As CultureInfo = {New CultureInfo("en-us"), _
New CultureInfo("fr-fr"), _
New CultureInfo("es-es"), _
New CultureInfo("de-de")}
For Each provider As CultureInfo In providers
Console.WriteLine("{0} ({1})", _
byteValue.ToString("N2", provider), provider.Name)
Next
輸出:
250.00 (en-US) 250,00 (fr-FR) 250,00 (es-ES) 250,00 (de-DE)
示例3: formats
Dim formats() As String = {"C3", "D4", "e1", "E2", "F1", "G", _
"N1", "P0", "X4", "0000.0000"}
Dim number As Byte = 240
For Each format As String In formats
Console.WriteLine("'{0}' format specifier: {1}", _
format, number.ToString(format))
Next
' The example displays the following output to the console if the
' current culture is en-us:
' 'C3' format specifier: $240.000
' 'D4' format specifier: 0240
' 'e1' format specifier: 2.4e+002
' 'E2' format specifier: 2.40E+002
' 'F1' format specifier: 240.0
' 'G' format specifier: 240
' 'N1' format specifier: 240.0
' 'P0' format specifier: 24,000 %
' 'X4' format specifier: 00F0
' '0000.0000' format specifier: 0240.0000
示例4: bytes
Dim bytes() As Byte = {0, 1, 14, 168, 255}
For Each byteValue As Byte In Bytes
Console.WriteLine(byteValue)
Next
' The example displays the following output to the console if the current
' culture is en-US:
' 0
' 1
' 14
' 168
' 255