DEV Community

Discussion on: Refactoring C# code using partial classes

Collapse
 
jwp profile image
John Peters

Nice... I first noticed partials showing up in code generation tools many years ago. The tool was telling us, "code up something to fill this partial gap". I thought that was very nice and cool at the same time.

Yes partials are a good coding construct for sure! Also, Extension Methods are just awesome. Too bad many C# shops don't use them more.

Thanks for the article.

Collapse
 
tyrrrz profile image
Oleksii Holub

That's true. Thank you for reading. 😌

Collapse
 
victorioberra profile image
Victorio Berra

Extension methods are very widely used. Check out IdentityServer and IdentityModel.

Collapse
 
jwp profile image
John Peters

I've worked at two companies in last 5 years, neither allowed extension methods.

I was astonished at their arrogance.

Thread Thread
 
victorioberra profile image
Victorio Berra

It's probably because they are difficult to test. There are solutions, but they are a little gross I'll admit. Regardless, they result in such a clean API surface compared to having to pass a bunch of things in as parameters.

Thread Thread
 
tyrrrz profile image
Oleksii Holub

They are not any harder to test than anything else.