本文整理汇总了VB.NET中System.TimeZoneNotFoundException.TimeZoneNotFoundException构造函数的典型用法代码示例。如果您正苦于以下问题:VB.NET TimeZoneNotFoundException构造函数的具体用法?VB.NET TimeZoneNotFoundException怎么用?VB.NET TimeZoneNotFoundException使用的例子?那么恭喜您, 这里精选的构造函数代码示例或许可以为您提供帮助。
在下文中一共展示了TimeZoneNotFoundException构造函数的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的VB.NET代码示例。
示例1: HandleInnerException
Private Sub HandleInnerException()
Dim timeZoneName As String = "Any Standard Time"
Dim tz As TimeZoneInfo
Try
tz = RetrieveTimeZone(timeZoneName)
Console.WriteLine("The time zone display name is {0}.", tz.DisplayName)
Catch e As TimeZoneNotFoundException
Console.WriteLine("{0} thrown by application", e.GetType().Name)
Console.WriteLine(" Message: {0}", e.Message)
If e.InnerException IsNot Nothing Then
Console.WriteLine(" Inner Exception Information:")
Dim innerEx As Exception = e.InnerException
Do
Console.WriteLine(" {0}: {1}", innerEx.GetType().Name, innerEx.Message)
innerEx = innerEx.InnerException
Loop While innerEx IsNot Nothing
End If
End Try
End Sub
Private Function RetrieveTimeZone(tzName As String) As TimeZoneInfo
Try
Return TimeZoneInfo.FindSystemTimeZoneById(tzName)
Catch ex1 As TimeZoneNotFoundException
Throw New TimeZoneNotFoundException( _
String.Format("The time zone '{0}' cannot be found.", tzName), _
ex1)
Catch ex2 As InvalidTimeZoneException
Throw New InvalidTimeZoneException( _
String.Format("The time zone {0} contains invalid data.", tzName), _
ex2)
End Try
End Function
开发者ID:VB.NET开发者,项目名称:System,代码行数:33,代码来源:TimeZoneNotFoundException
注:本文中的System.TimeZoneNotFoundException.TimeZoneNotFoundException构造函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论