public static void Main()
ExampleOne exampleOne = new ExampleOne();
ExampleThree exampleThree = new ExampleThree();
MyClass<ExampleThree> myClass = new MyClass<ExampleThree>(exampleThree);
string output = myClass.GetString();
Console.WriteLine(output);
public interface IExample
string GetExampleString();
public interface IAnotherExample
string MutateString(string input);
public class ExampleOne : IExample
public string GetExampleString()
public class ExampleTwo : IExample
public string GetExampleString()
public class ExampleThree : IExample, IAnotherExample
public string GetExampleString()
public string MutateString(string input)
return $"{input} Mutated";
public class MyClass<T> where T : IExample, IAnotherExample
private readonly T _example;
public MyClass(T example)
public string GetString()
string output = _example.GetExampleString();
output = _example.MutateString(output);