|
-
Jul 10th, 2006, 08:31 AM
#1
Thread Starter
Addicted Member
[RESOLVED] [2.0] vb6 "With" Statement
Hi,
I recall using the With statement in vb6 when i wanted to set a number of variables relating to the same object, something like this:
Code:
with tempObject
.Name = "name";
.Value = "Bob";
end with
Is there a c# equivelant to this and if so could somenbody let me know what it is please.
Many thanks,
Grant
-
Jul 10th, 2006, 08:37 AM
#2
Re: [2.0] vb6 "With" Statement
Use [code] source code here[/code] tags when you post source code.
My Articles
-
Jul 10th, 2006, 08:45 AM
#3
Thread Starter
Addicted Member
Re: [2.0] vb6 "With" Statement
Thanks for this.
This is indeed useful. Unfortunate though that it isn't implemented.
-
Jul 10th, 2006, 09:44 AM
#4
Re: [RESOLVED] [2.0] vb6 "With" Statement
The addition of a 'with' key word would be of no practical use whatsoever. The two advantages of using 'With' in VB are reduced typing and reduced need to re-evaluate the same properties repeatedly. The first is negated by Intellisense and copy-and-paste and the second can be achieved simply by declaring a local variable. One problem with the 'With' block in VB is that people tend to use them in places that they shouldn't and end up making their code less readable rather than the other way around.
-
Jul 11th, 2006, 03:08 PM
#5
Re: [RESOLVED] [2.0] vb6 "With" Statement
Don't fret, it's just having to type a few more characters on each line. Keyboards aren't very expensive these days.
-
Jul 11th, 2006, 09:04 PM
#6
Re: [RESOLVED] [2.0] vb6 "With" Statement
In addition to the other comments, AutoComplete is much better in C# 2005 than in VB (I rarely have to type an entire identifier), so you shouldn't miss 'With' that much.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|