vb System.Guid.ParseExact类(方法)实例源码

下面列出了vb System.Guid.ParseExact 类(方法)源码代码实例,从而了解它的用法。

作者:VB.NET开发    项目:Syste   
Module Example
   Public Sub Main()
      ' Define an array of all format specifiers.
      Dim formats() As String = { "N", "D", "B", "P", "X" }
      Dim guid As Guid = Guid.NewGuid()
      ' Create an array of valid Guid string representations.
      Dim stringGuids(formats.Length - 1) As String
      For ctr As Integer = 0 To formats.Length - 1
         stringGuids(ctr) = guid.ToString(formats(ctr))
      Next

      ' Parse the strings in the array using the "B" format specifier.
      For Each stringGuid In stringGuids
         Try
            Dim newGuid As Guid = Guid.ParseExact(stringGuid, "B")
            Console.WriteLine("Successfully parsed {0}", 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


问题


面经


文章

微信
公众号

扫码关注公众号