Поскольку Eric Gunnerson показывает в этом сообщении в блоге, в C# можно вложить using
операторы как:
using (StreamWriter w1 = File.CreateText("W1"))
using (StreamWriter w2 = File.CreateText("W2"))
{
// code here
}
Существует ли похожий способ сделать это в VB.Net? Я хочу избежать слишком многих уровней отступа.
Вот так:
Using a As New Thingy(), _
b As New OtherThingy()
...
End Using
Ну, вы можете:
Using w1 = File.CreateText("W1"), w2 = File.CreateText("W2")
' Code goes here. '
End Using