It's not in C# but in VB.NET it is. And it doesn't make the code harder to
read.
It even makes it easier to write little faster code.
TextBox1.Text = "This";
TextBox1.Enabled = true;
.....
would each time call the get accessor of the TextBox1-Property (if its not a
field) wich can have a little performance impact.
The with construct makes something like:
TextBox t = TextBox1;
t.Text = "This";
t.Enabled = true;
......
t = null;
imho the with statement is easier to read and to type and in most cases it's
(a bit) faster.
this is one of the few VB-features i would like to have in c#
Christof
"Lebesgue" <no****@spam.jp> schrieb im Newsbeitrag
news:uO**************@TK2MSFTNGP15.phx.gbl...
No, there is no such construct in C# and I believe in VB.NET neither.
'With'
is considered to make the code harder to read
"John S" <jo********@cinfin.com> wrote in message
news:11*********************@f14g2000cwb.googlegro ups.com... In Visual Basic, there was a keyword called "With". If you referenced
an object with the keyword With you could access all properties and
events just using the "." and not having to use the object name.
Example
With TextBox1
.text = "This"
.enabled=true
.maxLength = 11
end with
Is there anyting like this in C#