Hi, Fabio!
>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?
Well, as Hugo pointed out, this is something beyond the with/endwith problem. My question is what's the value of with/endwith in C#? I can't really see any. Instead, C# has powerful and meaningful constructions like "using", which provides an execution context for a disposable resource, simplifying the error handling code VERY much.
Regards,