C# equivalent for Visual Basic keyword: 'With' … 'End With'?

后端 未结 7 1977
南笙
南笙 2020-12-11 04:21

In Visual Basic, if you are going to change multiple properties of a single object, there\'s a With/End With statement:

Dim myObject as Object

         


        
7条回答
  •  孤城傲影
    2020-12-11 04:42

    VB.NET includes some of VB6's design flaws for the sake of backward compatibility. While Javascript has the same design flaw (indeed an even worse one, as its with leads to more ambiguous constructs), most other C-syntax languages don't, so there's no backward-compatibility benefit in adding it to C#.

提交回复
热议问题