Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP's With...EndWith equivalent in C# ?
Message
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
C# 2.0
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01216132
Message ID:
01216527
Views:
17
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.
-----
Fabio Vazquez
http://www.fabiovazquez.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform