similar to VB. for example (VB): with response .write("some text") .write(vbnewline) .end end with i suppose the C# version would look something like: with response { .write("some text"); .write(vbnewline); .end; } ...i also like VB's use of the "!" in such
a manner: response.write request.querystring.item("page") ...can also be coded as: response.write request.querystring!page i just learned this one a couple months ago. its pretty cool IMO.
ThisHereThing thing = new ThisHereThing(); with (thing) { .DoSomething(); .Arity = 8; } OR with (new ThisHereThing()) { .DoSomething(); .Arity = 8; } with or without the leading periods. see vb or javascript.
Well I see why you might like it (especially if you liked it in VB), but I hate that feature. I know you might say, "then avoid it," but it's not always the case that you're working with YOUR code.
"with" is a dirty feature, and makes code confusing and strange looking. I did a bunch of work in VB, and used it myself. However, I found that it really doesn't save time. I agree the feature should be available, but I would say only use it when you really
really really need it, which should be never.
i've also done a bunch of work in VB and found the feature to be quite useful, especially when considering its use similar to the "using" construct. we used it with much success and developed ways to streamline code, making it more maintainable in the process.
what i see being posted are preferences, roughly equivalent to the fight between curly braces on the same line or starting below. since i write the coding standards for my team, i ultimately get to choose.
hlaford
Contributor
2595 Points
520 Posts
gimme a "with" keyword in C#
Oct 02, 2002 05:52 PM|LINK
crowdozer
Member
145 Points
29 Posts
Re: gimme a "with" keyword in C#
Oct 08, 2002 03:28 PM|LINK
pickyh3d
Star
9696 Points
1955 Posts
Re: gimme a "with" keyword in C#
Oct 13, 2002 10:09 PM|LINK
crowdozer
Member
145 Points
29 Posts
Re: gimme a "with" keyword in C#
Oct 14, 2002 12:37 PM|LINK
hlaford
Contributor
2595 Points
520 Posts
Re: gimme a "with" keyword in C#
Oct 14, 2002 12:41 PM|LINK
pickyh3d
Star
9696 Points
1955 Posts
Re: gimme a "with" keyword in C#
Oct 14, 2002 01:48 PM|LINK
AdvanIntel
Participant
1340 Points
259 Posts
ASPInsiders
Re: gimme a "with" keyword in C#
Oct 15, 2002 01:28 PM|LINK
Some of my websites
aspNetEmail.com
SystemNetMail.com
SystemWebMail.com
hlaford
Contributor
2595 Points
520 Posts
Re: gimme a "with" keyword in C#
Oct 16, 2002 12:45 PM|LINK
themastuh
Member
145 Points
29 Posts
Re: gimme a "with" keyword in C#
Oct 22, 2002 02:15 PM|LINK
hlaford
Contributor
2595 Points
520 Posts
Re: gimme a "with" keyword in C#
Oct 23, 2002 12:54 PM|LINK