作者:VB.NET开发
项目:Syste
Module Example
Public Sub Main()
Dim originalGuid As Guid = Guid.NewGuid()
' Create an array of string representations of the GUID.
Dim stringGuids() As String = { originalGuid.ToString("B"),
originalGuid.ToString("D"),
originalGuid.ToString("X") }
' Parse each string representation.
For Each stringGuid In stringGuids
Try
Dim newGuid As Guid = Guid.Parse(stringGuid)
Console.WriteLine("Converted {0} to a Guid", stringGuid)
Catch e As ArgumentNullException
Console.WriteLine("The string to be parsed is null.")
Catch e As FormatException
Console.WriteLine("Bad format: {0}", stringGuid)
End Try
Next
End Sub
End Module