fork download
  1. using System;
  2.  
  3. public interface MyInterface<T>
  4. {
  5. string GetData();
  6. }
  7. public class MyClass<T> : MyInterface<T>
  8. {
  9. private T _t;
  10. public string GetData() { return "MyClass.GetData"; }
  11. string MyInterface<T>.GetData() { return "MyInterface.GetData"; }
  12. }
  13.  
  14. public class Test
  15. {
  16. public static void Main()
  17. {
  18. var x = new MyClass<int>();
  19. MyInterface<int> y = x;
  20. Console.WriteLine(x.GetData());
  21. Console.WriteLine(y.GetData());
  22. }
  23. }
Success #stdin #stdout 0.02s 33728KB
stdin
Standard input is empty
stdout
MyClass.GetData
MyInterface.GetData