為了使用Try/Catch方法進行處理
Try
Catch
Finally
使用這種模式的圖像代碼如下
Public Shared Sub GenerateThumbnail(ByVal SourceImagePath As String
Dim newHeight As Short
Dim newWidth As Short
Dim sourceImage As Image=Nothing
Dim targetImage As Image=Nothing
Try
sourceImage = Image
newHeight = CShort(sourceImage
newWidth = CShort(sourceImage
Dim cb As New Image
Try
targetImage= sourceImage
targetImage
Catch ex As Exception
Finally
If targetImage IsNot Nothing Then
targetImage
End If
End Try
Catch ex As Exception
Finally
If sourceImage IsNot Nothing Then
sourceImage
End If
End Try
可以立刻看到這段代碼非常難以讀懂
[
From:http://tw.wingwit.com/Article/program/net/201311/15273.html