本文整理汇总了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}