Click here to Skip to main content
15,909,518 members

Survey Results

Should C# get the VB-style "with" keyword?   [Edit]

Survey period: 6 Oct 2008 to 13 Oct 2008

If not then maybe we could look into the "Ain't" keyword...

OptionVotes% 
Yes27937.20
No47162.80



 
GeneralI definitely want an isnt or aint operator Pin
PIEBALDconsult6-Oct-08 5:41
mvePIEBALDconsult6-Oct-08 5:41 
GeneralRe: I definitely want an isnt or aint operator Pin
Adam Maras6-Oct-08 6:40
Adam Maras6-Oct-08 6:40 
GeneralRe: I definitely want an isnt or aint operator Pin
Theodore M. Seeber6-Oct-08 8:12
Theodore M. Seeber6-Oct-08 8:12 
GeneralI find statements with with harder to read [modified] Pin
Don Kackman6-Oct-08 5:10
Don Kackman6-Oct-08 5:10 
GeneralRe: I find statements with with harder to read Pin
PIEBALDconsult6-Oct-08 5:47
mvePIEBALDconsult6-Oct-08 5:47 
GeneralRe: I find statements with with harder to read Pin
John M. Drescher6-Oct-08 9:21
John M. Drescher6-Oct-08 9:21 
GeneralRe: I find statements with with harder to read Pin
Jeremy Falcon7-Oct-08 8:56
professionalJeremy Falcon7-Oct-08 8:56 
GeneralRe: I find statements with with harder to read Pin
Don Kackman7-Oct-08 10:11
Don Kackman7-Oct-08 10:11 
Jeremy Falcon wrote:
$20 says it's mainly because you're not used to it. After using it for years I can say it's not that hard.


Sweet! You owe me $20! Poke tongue | ;-P

I cut my teeth on VB3-6 and have seen (and used) my share of with statements. If common usage were limited to:
with myObject
   .field1 = 0
   .field2 = 1
end with

it's not so bad.

Unfortunately, over the lifetime of an app all too often you end up with
with myObject
   .field1 = 0
   if someBool then
     .DoSomething
   end if

[20 lines later]

   .DoSomethingElse

[20 lines later still]

   .field3 = .field1 + .field2

[at the bottom of a 500 line method with a bunch of other logic intertwingled]
end with


All of the above mixed in with loops, branches and other objects being used.

Having done plenty of both VB syntax and C style syntax development I think the with statement is really nothing more than a reaction to VB's excess verbosity, saving some keystrokes and sacrificing readability and maintainability.
GeneralRe: I find statements with with harder to read Pin
Jeremy Falcon7-Oct-08 10:24
professionalJeremy Falcon7-Oct-08 10:24 
GeneralRe: I find statements with with harder to read Pin
Don Kackman7-Oct-08 10:35
Don Kackman7-Oct-08 10:35 
GeneralRe: I find statements with with harder to read Pin
Jeremy Falcon8-Oct-08 6:21
professionalJeremy Falcon8-Oct-08 6:21 
General"With" is one of the few VB-specific constructs I can stand Pin
Adam Maras6-Oct-08 5:06
Adam Maras6-Oct-08 5:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.