Hey Guys,
Despite all the reasons already put here, I think that such a construction in C# would cause some major legibility problems. The main reason that leads me to think so is the fact that in C# any line break character present in the source file is normalized into a regular space by the compiler. In VB.NET the statement must be terminated on the same line or explicitly be broken with the "_" (underscore) char.
Having said that, in a perfect world, a simple "with" construction in C# would be like that:
TextBox field = new TextBox();
with (field)
{
.Text = "foo";
}
But my immagination keeps trying to convince me that things like the following would be easily found:
TextBox field = new TextBox();
with (field)
{
.
Text = "foo";
}
Where is "Wally" <g>? Ops... where is the dot?
Kinda weird, huh?
Well, even this being a paranoic thinking of mine, I'd prefer keep living in this more verbose C# world we have today.
Just my opinion anyway.