Click here to Skip to main content
15,903,012 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: do you use extension methods intensively in your projects? Pin
obermd18-Oct-16 14:41
obermd18-Oct-16 14:41 
GeneralRe: do you use extension methods intensively in your projects? Pin
Garth J Lancaster14-Oct-16 17:54
professionalGarth J Lancaster14-Oct-16 17:54 
GeneralRe: do you use extension methods intensively in your projects? Pin
Jörgen Andersson14-Oct-16 20:19
professionalJörgen Andersson14-Oct-16 20:19 
GeneralRe: do you use extension methods intensively in your projects? Pin
#realJSOP14-Oct-16 20:45
professional#realJSOP14-Oct-16 20:45 
GeneralRe: do you use extension methods intensively in your projects? Pin
OriginalGriff14-Oct-16 21:32
mveOriginalGriff14-Oct-16 21:32 
GeneralRe: do you use extension methods intensively in your projects? Pin
Sander Rossel15-Oct-16 0:04
professionalSander Rossel15-Oct-16 0:04 
GeneralRe: do you use extension methods intensively in your projects? Pin
BillWoodruff15-Oct-16 3:52
professionalBillWoodruff15-Oct-16 3:52 
GeneralRe: do you use extension methods intensively in your projects? Pin
Sander Rossel15-Oct-16 4:11
professionalSander Rossel15-Oct-16 4:11 
The entire LINQ library depends upon it.
For example the Count() extension method on collections may look as follows:
C#
public static class Extensions
{
    public static int Count<T>(this IEnumerable<T> collection)
    {
        int count = 0;
        using (var enumerator = collection.GetEnumerator())
        {
            while (enumerator.MoveNext())
            {
                count += 1;
            }
        }
        return count;
    }
}
The actual extension method checks for null and tries to cast to ICollection<T> and ICollection for the Count property first, but it's an extension on an interface.
There are LOTS of them...
Read my (free) ebook Object-Oriented Programming in C# Succinctly.
Visit my blog at Sander's bits - Writing the code you need.
Or read my articles here on CodeProject.
Simplicity is prerequisite for reliability.
— Edsger W. Dijkstra
Regards,
Sander

GeneralRe: do you use extension methods intensively in your projects? Pin
Southmountain15-Oct-16 8:33
Southmountain15-Oct-16 8:33 
GeneralRe: do you use extension methods intensively in your projects? Pin
Fabio Franco17-Oct-16 0:15
professionalFabio Franco17-Oct-16 0:15 
GeneralRe: do you use extension methods intensively in your projects? Pin
Sander Rossel17-Oct-16 1:15
professionalSander Rossel17-Oct-16 1:15 
GeneralRe: do you use extension methods intensively in your projects? Pin
Wendelius14-Oct-16 23:10
mentorWendelius14-Oct-16 23:10 
GeneralRe: do you use extension methods intensively in your projects? Pin
#realJSOP14-Oct-16 23:13
professional#realJSOP14-Oct-16 23:13 
GeneralRe: do you use extension methods intensively in your projects? Pin
Wendelius14-Oct-16 23:18
mentorWendelius14-Oct-16 23:18 
GeneralRe: do you use extension methods intensively in your projects? Pin
Duncan Edwards Jones14-Oct-16 23:15
professionalDuncan Edwards Jones14-Oct-16 23:15 
GeneralRe: do you use extension methods intensively in your projects? Pin
#realJSOP14-Oct-16 23:57
professional#realJSOP14-Oct-16 23:57 
GeneralRe: do you use extension methods intensively in your projects? Pin
Southmountain15-Oct-16 8:31
Southmountain15-Oct-16 8:31 
GeneralRe: do you use extension methods intensively in your projects? Pin
Sander Rossel15-Oct-16 0:06
professionalSander Rossel15-Oct-16 0:06 
GeneralRe: do you use extension methods intensively in your projects? Pin
harold aptroot15-Oct-16 1:18
harold aptroot15-Oct-16 1:18 
GeneralRe: do you use extension methods intensively in your projects? Pin
Cameron Oltmann17-Oct-16 4:01
Cameron Oltmann17-Oct-16 4:01 
GeneralRe: do you use extension methods intensively in your projects? Pin
harold aptroot17-Oct-16 5:57
harold aptroot17-Oct-16 5:57 
GeneralRe: do you use extension methods intensively in your projects? Pin
Cameron Oltmann17-Oct-16 13:47
Cameron Oltmann17-Oct-16 13:47 
GeneralRe: do you use extension methods intensively in your projects? Pin
Marc Clifton15-Oct-16 3:08
mvaMarc Clifton15-Oct-16 3:08 
GeneralRe: do you use extension methods intensively in your projects? Pin
BillWoodruff15-Oct-16 3:16
professionalBillWoodruff15-Oct-16 3:16 
GeneralRe: do you use extension methods intensively in your projects? Pin
Southmountain15-Oct-16 8:30
Southmountain15-Oct-16 8:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.