Why would you write extension methods for the type you own?

This page summarizes the projects mentioned and recommended in the original post on /r/dotnet

Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
  • command-line-api

    Command line parsing, invocation, and rendering of terminal output.

    In the source of https://github.com/dotnet/command-line-api/tree/main/src/System.CommandLine there is a Command class which represents a invocation path for a command line program. There is a corresponding CommandExtensions class which is basically a set of extension methods for Command class. This library owns the Command class and yet extension methods are defined for it. What could be the reason for this decision when all the methods can be directly defined inside the command class?

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts