Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
With...end with in C# ?
Message
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
01064849
Message ID:
01065798
Views:
21
>>With/Endwith is a readability issue more than anything else.
>
>I think there's a definite speed issue. Doesn't using the long version mean that the application has to 'walk' the entire chain of pointers each time you reference the object?

Not with an optimizing compiler <g>... but then I don't think the C# compiler current does that sort of optimization.


with endwith is really compiler sugar and the compiler behind the scenes actually creates a variable and uses it.

So if you want to do this in C# the way to approach this is to use a local variable instead of the with/endwith which gives the same performance and most likely very close IL code.

Personally I never used with/endwith even in VFP which had it. I prefer readibility of a local variable because THAT clearly identifies what you are dealing with.
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform