Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
With...end with in C# ?
Message
From
04/11/2005 13:18:02
 
 
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
01064849
Message ID:
01065543
Views:
16
Neil,

>>It shows a workaround

Oh. I wouldn't exactly call it a workaround. In the examples given
// this way
MyDataStructure.GetButton(44).Text = "Hello";
MyDataStructure.GetButton(44).BackColor = Color.Blue;

// vs this way
Button b = MyDataStructure.GetButton(44);
b.Text = "Hello";
b.BackColor = Color.Blue ;
this might be considered an "alternative" way to set these properties (as opposed to a "workaround"). But what if the method you're calling does other things before it returns it's object. And what if you could only call that method once (because you couldn't have those "other things" execute more than once). Then, this would be the *only* way to do it. And for readability, I would most likely have done it that way to begin with ... and that was most likely your point. With/Endwith is a readability issue more than anything else. So, we're talking semantics really.

I know, I know ... I'm being argumentative for argument's sake. Well, people tell me I do that all the time ... it's sport to me. <g>

~~Bonnie




>Bonnie,
>
>It shows a workaround, I know you can't do with..endwith what they are saying is its essentially the same as creating a temporary reference and using that.
>
>Regards
>Neil
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform