namespace ConsoleApplication9
public static void Main(string[] args)
IGenericInterface<string> testClass = new GenericClass<string>();
testClass.DoSomething<object>();
testClass.DoSomething2<object, string>();
public interface IGenericInterface<TSource>
void DoSomething<TDest>();
public class GenericClass<TSource> : IGenericInterface<TSource>
public void DoSomething<TDest>()
Console.WriteLine(">From DoSomething");
Console.WriteLine("TSource type: {0}", typeof(TSource));
Console.WriteLine("TDest type: {0}", typeof(TDest));
internal static class Extensions
public static void DoSomething2<TDest, TSource>(this IGenericInterface<TSource> interf)
Console.WriteLine(">From DoSomething2");
Console.WriteLine("TSource type: {0}", typeof(TSource));
Console.WriteLine("TDest type: {0}", typeof(TDest));