Interesting discussion that came up on the ALT.NET list. Many people simply say don't do that but they have a time and place and should be weighed like any other architectural or API decision. While I find that many people will misuse this feature to extremes and code will quickly become unmaintainable I can understand the possible benefits of them (especially in the context of LINQ).
So my #1 best practice for extension methods?
ALL extension methods should be [SIDE EFFECT FREE FUNCTIONS]
I wish that the C# compiler would enforce this rule to not let you create an extension method that was not side effect free but unfortunately this is not the case. Extension methods that change state are quite evil.
What do you see as best practices?
Posted
Mon, Nov 19 2007 1:37 AM
by
Greg