【发布时间】:2020-06-12 19:30:47
【问题描述】:
我只是迷失了试图纠正这个错误
错误 BC36010“使用”“布尔”类型的操作数必须实现“System.IDisposable”
只有当我从下面的代码中删除 If End If 设计并实施 Using
时,才会出现错误
使用 Using End Using 的原因是垃圾清理
那么问题是如何实现 System.IDisposable ?
Public Sub haveFILE()
'Dim path As String = "C:\Users\Me\source\repos\TestForms\TestForms\Resource\"
Using Not My.Computer.FileSystem.FileExists(path & "Check.txt") Then
tbHaveDB.Text = "File NOT Found"
' Create or overwrite the file.
Dim fs As FileStream = File.Create(path & "Check.txt")
fs.Close()
End Using
End Sub
【问题讨论】:
标签: vb.net try-catch idisposable