我想知道,在VB.NET中是:
Using tBrush = New SolidBrush(UseColor)
e.Graphics.FillRectangle(tBrush, someRect)
End Using
相当于:
e.Graphics.FillRectangle(New SolidBrush(UseColor), someRect)
?
即。在第二种情况下,将在FillRectangle完成后立即释放SolidBrush吗?
简短的回答,是的,它们是等效的。是的,第二支刷子将被释放,垃圾收集器将在某个时候得到它。