Environment versions
Network:
Windows 2008 Server
>>I'm refactoring some methods which have the pattern:
>>
>>Do some common stuff
>>Do some specific stuff
>>Do some more common stuff
>>
>>Where the "Do some specific stuff" is really instance code implemented as:
>>
>>Select Case...
>>
>>or
>>
>>IF
>>Else If
>>Else If
>>.
>>.
>>.
>>.
>>
>>Some of these methods are 2000+ lines long :(
>>
>>I am thinking of passing in a delegate for "Do specific stuff" because I know at design time what needs to be called.
>>is this a reasonable approach?
>>
>>Or
>>
>>Is a better approach to create methods for
>>
>>CommonStuff()
>>SpecificStuff()
>>MoreCommonStuff()
>>
>>The delegate approach seems cleaner, I just wonder if I am missing something obvious. Any Thoughts?
>>
>>Thanks
>>
>>Bruce
>
>
>Delegates get my vote. If you really wanted to make it extensible you could maybe mess around with MEF but that might be overkill....
Thank you for the vote. MEF sounds interesting, but were are still on .NET 3.5. Always something new to learn.
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only