Extension methods in LINQ
Why Extensions method are used in LINQ?
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Pravin MoreRank #1,419 · 1.2K reputationPosted Oct 11, 2011, 8:42 PM EDT
Extension methods are used to change behaviour of existing .net type according to need means you can customize it.
For example, you may decide that you don't like the way where works, so you add a new where to your code that provides the functionality you want. This feature can significantly change the way LINQ works and make your coding significantly easier by customizing it.
e.g IEnumerable
Thanx,hope it will help you.
Pravin.
VulpesRank #55 · 29.2K reputationPosted Oct 12, 2011, 12:23 AM EDT
Jignesh TrivediRank #16 · 50.3K reputationPosted Jan 2, 2012, 11:05 PM EST
Extension method used to customize, behaviour of exsiting and new method which is used frequently.
for example.
string have ToString() method, as we know that ToString does not handle null condition. you may write your extension method which may also handle null.
it help us to reduce code(like functions).
hope this help.