如何做,如果發生異常我如何測試是否requestStream關閉並設置
Try
Using requestStream As Stream = rqst.GetRequestStream()
requestStream.Write(fle, 0, fle.Length)
Throw New ApplicationException("Exception Occured")
End Using
Catch ex As Exception
MessageBox.Show(ex.Message.ToString())
Finally
'test if the requeststream is closed and disposed?
MessageBox.Show("")
End Try
感謝是可以測試?即時通訊實施idispose但不知道如何? –
IDisposable沒有'Disposed'屬性,所以可能不會,儘管你可以在'End Using'之後的'requestStream'上嘗試一些操作並確保它們拋出'ObjectDisposedException'。 – spender
它不會讓我建立它,如果我添加後 - 謝謝 –