How would you implement a “trait” design-pattern in C#?
You can get the syntax by using marker interfaces and extension methods. Prerequisite: the interfaces need to define the contract which is later used by the extension method. Basically the interface defines the contract for being able to “implement” a trait; ideally the class where you add the interface should already have all members of … Read more