If you want people to use your extension methods…

… you need to make them discoverable. That means temporarily abandoning your solution-structure-based namespaces and placing them directly in the namespace of the class you are extending so it comes up in intellisense immediately. Even if it’s from a totally different library, or System.* itself.

namespace YourCompany.Common.Extensions 
{
    // don't expect anyone to find this here
    public static class LinqExtensions { ... }
}

namespace System.Linq // can't miss it!
{
    public static class LinqExtensions { ... }
}

If you’re using ReSharper you can also hit Alt+Enter and add the following so it won’t trigger code inspection warnings:

// ReSharper disable CheckNamespace
namespace System.Linq
// ReSharper restore CheckNamespace
{
    public static class LinqExtensions { ... }
}

2 thoughts on “If you want people to use your extension methods…

Comments are closed.