Skip to content

IRouterExtensions #134

Answered by scottoffen
pborchert asked this question in Q&A
Aug 12, 2022 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

It's a code management pattern I sometimes use to separate out different logical parts. IMHO it makes the code easier to follow when I haven't looked at it for awhile.

You'll notice, for example, that in the second partial class there is a private property. That property does not make any sense in the context of any other extension method. Putting the property and the method in a partial class that is separate from the rest of the extension methods quickly makes the point that the property is only used by and useful to the method it is grouped into the partial class with, as well as prevents access to it by other methods in the same class. I could just make two different extension classes…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@pborchert
Comment options

Answer selected by scottoffen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants