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

后端 未结 7 1853
南笙
南笙 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:52

    If you're trying to avoid lots of typing you can give your object a shorter name:

    var x = myObject;
    x.property1 = something;
    x.property2 = something2;
    
    0 讨论(0)
提交回复
热议问题