我想知道在C#中是否有可以像with command
在Delphi中那样使用的命令?
// like this :
with(textbox1)
{
.text="some text as text of text box";
.tag=1231;
}
//在Delphi中
with edit1 do
begin
text="some text as text of edit1";
tag=1231;
end;
不适用于已经创建的实例。
但是,创建新实例时,你可以执行以下操作:
var textbox1 =
new Textbox
{
Text = "some text as text of text box",
Tag = 1231
};