Is there an equivalent for Delphi's “with” command in c#?

前端 未结 5 582
借酒劲吻你
借酒劲吻你 2021-01-17 17:52

I was wondering if there is a command in C# which I can use like with command in Delphi?

// like this :
with(textbox1)
{
   .text=\"some text as         


        
5条回答
  •  情书的邮戳
    2021-01-17 18:03

    Not for already created instances.

    However, when you create a new instance you can do:

    var textbox1 = 
       new Textbox
       {
           Text = "some text as text of text box",
           Tag = 1231
       };
    

提交回复
热议问题