I tend to shy away from extension methods (in C# ), as it violates ‘code cohesion’ principle of software engineering.
Then, why is it there? or is my understanding wrong?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
On the contrary, I believe judicious use of extension methods improves code cohesion, as you can put methods and classes doing related tasks together. The situation is no different from free (static) methods and Koenig lookup in C++, extension access with
.is merely syntactic sugar.