Click here to Skip to main content
15,908,673 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



 
GeneralRe: If you need the with keyword Pin
Jeremy Falcon8-Oct-08 6:33
professionalJeremy Falcon8-Oct-08 6:33 
GeneralRe: If you need the with keyword Pin
Ennis Ray Lynch, Jr.8-Oct-08 6:40
Ennis Ray Lynch, Jr.8-Oct-08 6:40 
GeneralRe: If you need the with keyword Pin
Jeremy Falcon8-Oct-08 6:48
professionalJeremy Falcon8-Oct-08 6:48 
GeneralI don't constantly check either, I just get email alerts and am easily distracted Pin
Ennis Ray Lynch, Jr.8-Oct-08 7:17
Ennis Ray Lynch, Jr.8-Oct-08 7:17 
GeneralRe: I don't constantly check either, I just get email alerts and am easily distracted Pin
Jeremy Falcon9-Oct-08 10:44
professionalJeremy Falcon9-Oct-08 10:44 
GeneralRe: If you need the with keyword Pin
Scott Barbour8-Oct-08 8:48
Scott Barbour8-Oct-08 8:48 
GeneralRe: If you need the with keyword Pin
Ennis Ray Lynch, Jr.8-Oct-08 9:00
Ennis Ray Lynch, Jr.8-Oct-08 9:00 
GeneralRe: If you need the with keyword [modified] Pin
Scott Barbour8-Oct-08 10:22
Scott Barbour8-Oct-08 10:22 
How would you refactor this?
object.we.did.not.design.but.must.use.PropertyA = "String"
Sadly, not every component that goes into our apps are ones that we have created ourselves.

Not every solution can be perfect, but we can at least strive to make it as elegant as possible.

Granted that this is still a simplification, but here is a real world object hierarchy that is this complex (the JulMar.ATAPI namespace for .NET TAPI development):
TapiManager.Lines(0).Addresses(0).Calls(0).Features(0).CanPark


No one ever said that the "With" keyword was added to make it easy. In fact, the "With" keyword can cause problems if misused (But so can c/c++). Yes, you can write code that does the exact same thing without using the "With" keyword. You can also perform multiplication using only the addition operator. Should we get rid of the multiplication operator?

I have not bothered to learn C#. The only reason is that I have yet to find anything I could not do using VB.NET that I could do in C#. Why buy a red handled screwdriver when I already own a blue one?

Back in the days before .NET, using a With block was very handy when working with databases as you could have code that was easy to read like this:
With rsEmployee
   .AddNew
   ![Name] = "John Doe"
   ![Title] = "Peon"
   ![Extension] = "123"
   .Update
End With
This comprised 99.9% of all With blocks I've used.

I don't claim to be a know it all, for I know that I am not...

I usually have an answer though.


modified on Wednesday, October 8, 2008 4:38 PM

GeneralRe: If you need the with keyword Pin
Ennis Ray Lynch, Jr.8-Oct-08 10:46
Ennis Ray Lynch, Jr.8-Oct-08 10:46 
GeneralRe: If you need the with keyword Pin
dmitri_sps7-Oct-08 21:55
dmitri_sps7-Oct-08 21:55 
GeneralRe: If you need the with keyword [modified] Pin
sucram7-Oct-08 23:08
sucram7-Oct-08 23:08 
GeneralRe: If you need the with keyword Pin
Paul Watson8-Oct-08 1:53
sitebuilderPaul Watson8-Oct-08 1:53 
GeneralRe: If you need the with keyword [modified] Pin
sucram8-Oct-08 2:53
sucram8-Oct-08 2:53 
GeneralRe: If you need the with keyword Pin
Jeremy Falcon8-Oct-08 6:17
professionalJeremy Falcon8-Oct-08 6:17 
GeneralWhat's VB? Pin
Ravi Bhavnani6-Oct-08 9:50
professionalRavi Bhavnani6-Oct-08 9:50 
GeneralRe: What's VB? Pin
ed welch6-Oct-08 10:30
ed welch6-Oct-08 10:30 
GeneralRe: What's VB? Pin
Vasudevan Deepak Kumar6-Oct-08 11:38
Vasudevan Deepak Kumar6-Oct-08 11:38 
GeneralRe: What's VB? Pin
Ravi Bhavnani6-Oct-08 11:43
professionalRavi Bhavnani6-Oct-08 11:43 
GeneralRe: What's VB? Pin
Nemanja Trifunovic6-Oct-08 12:00
Nemanja Trifunovic6-Oct-08 12:00 
GeneralRe: What's VB? Pin
Ravi Bhavnani6-Oct-08 12:03
professionalRavi Bhavnani6-Oct-08 12:03 
GeneralRe: What's VB? Pin
Lutosław7-Oct-08 5:26
Lutosław7-Oct-08 5:26 
GeneralRe: What's VB? Pin
Jeremy Falcon7-Oct-08 9:00
professionalJeremy Falcon7-Oct-08 9:00 
GeneralRe: What's VB? Pin
Lutosław7-Oct-08 9:53
Lutosław7-Oct-08 9:53 
GeneralRe: What's VB? Pin
Jeremy Falcon7-Oct-08 10:11
professionalJeremy Falcon7-Oct-08 10:11 
GeneralRe: What's VB? Pin
Jeremy Falcon7-Oct-08 9:01
professionalJeremy Falcon7-Oct-08 9:01 

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.