<分区>
Possible Duplicate: Equivalence of “With…End With” in C#?
所以我不知道以前是否有人问过这个问题,我不是VB.NET的忠实粉丝。 .但是我在 C# 中缺少的一种语法是 With
语法。
在 VB.NET 中你可以这样写:
Dim sb As New StringBuilder
With sb
.Append("foo")
.Append("bar")
.Append("zap")
End With
C# 中是否有我遗漏的语法可以做同样的事情?