I am designing an interface
in a C# project which will be extended with various extension methods
. Now I thought of putting the static class containing the extension methods in the same file as the interface itself.
I am not sure though if this is against the principle of 1 thing per file
.
I tend to think that this is related so closely that they can go into the same file. Yet I'd still like to hear the opinion of a more experienced developer.
In terms of maintainability, code readability and good structure, what would be the way to go here? I thought of something along the lines of:
public interface IFoo
{
int Property { get; }
void Method();
}
public static class IFooExtensions
{
public static void AnExtension(this IFoo foo)
{
// Do Something
}
public static void AnotherExtension(this IFoo foo)
{
// Do Something else
}
}
Where all of this would go into the same file. Thanks for any advice!