using System.Collections;
using System.Collections.Generic;
public interface MyInterfaceFunc {
void Call<T>(MyInterface<T> obj);
public interface MyInterface {
void Generically(MyInterfaceFunc func);
public interface MyInterface<T> : MyInterface
void DoSomething(T something);
public class MyIntClass : MyInterface<int>
public int GetSomething()
public void DoSomething(int something)
Console.Write(something);
public void Generically(MyInterfaceFunc func) {
public class MyStringClass : MyInterface<string>
public string GetSomething()
public void DoSomething(string something)
Console.Write(something);
public void Generically(MyInterfaceFunc func) {
public class MyFunc : MyInterfaceFunc {
public void Call<T>(MyInterface<T> thingDoer) {
T something = thingDoer.GetSomething();
thingDoer.DoSomething(something);
thingDoer.DoSomething(something);
public static void Main(){
var listOfThings = new List<MyInterface>(){
foreach (MyInterface thingDoer in listOfThings){
thingDoer.Generically(new MyFunc());