本文整理匯總了VB.NET中System.Guid.Guid構造函數的典型用法代碼示例。如果您正苦於以下問題:VB.NET Guid構造函數的具體用法?VB.NET Guid怎麽用?VB.NET Guid使用的例子?那麽, 這裏精選的構造函數代碼示例或許可以為您提供幫助。您也可以進一步了解該構造函數所在類System.Guid
的用法示例。
在下文中一共展示了Guid構造函數的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: Example
Module Example
Public Sub Main()
Dim guidStrings() As String = { "ca761232ed4211cebacd00aa0057b223",
"CA761232-ED42-11CE-BACD-00AA0057B223",
"{CA761232-ED42-11CE-BACD-00AA0057B223}",
"(CA761232-ED42-11CE-BACD-00AA0057B223)",
"{0xCA761232, 0xED42, 0x11CE, {0xBA, 0xCD, 0x00, 0xAA, 0x00, 0x57, 0xB2, 0x23}}" }
For Each guidString In guidStrings
Dim guid As New Guid(guidString)
Console.WriteLine("Original string: {0}", guidString)
Console.WriteLine("Guid: {0}", guid)
Console.WriteLine()
Next
End Sub
End Module
輸出:
Original string: ca761232ed4211cebacd00aa0057b223 Guid: ca761232-ed42-11ce-bacd-00aa0057b223 Original string: CA761232-ED42-11CE-BACD-00AA0057B223 Guid: ca761232-ed42-11ce-bacd-00aa0057b223 Original string: {CA761232-ED42-11CE-BACD-00AA0057B223} Guid: ca761232-ed42-11ce-bacd-00aa0057b223 Original string: (CA761232-ED42-11CE-BACD-00AA0057B223) Guid: ca761232-ed42-11ce-bacd-00aa0057b223 Original string: {0xCA761232, 0xED42, 0x11CE, {0xBA, 0xCD, 0x00, 0xAA, 0x00, 0x57, 0xB2, 0x23}} Guid: ca761232-ed42-11ce-bacd-00aa0057b223
示例2: Example
Module Example
Public Sub Main()
Dim g As New Guid(&hA, &hB, &hC,
New Byte() { 0, 1, 2, 3, 4, 5, 6, 7 } )
Console.WriteLine("{0:B}", g)
End Sub
End Module
輸出:
{0000000a-000b-000c-0001-020304050607}