fork download
  1. using System;
  2.  
  3. public interface IMyInterface1 : IDisposable
  4. {
  5. void DoSomething();
  6. }
  7.  
  8. public interface IMyInterface2 : IDisposable
  9. {
  10. void DoSomethingElse();
  11. }
  12.  
  13. public class MyClass : IMyInterface1, IMyInterface2
  14. {
  15. public void DoSomething() { Console.WriteLine("I'm doing something..."); }
  16. public void DoSomethingElse() { Console.WriteLine("I'm doing something else..."); }
  17. public void Dispose() { Console.WriteLine("Bye bye!"); }
  18. }
  19.  
  20. class Program
  21. {
  22. public static void Main(string[] args)
  23. {
  24. using (IMyInterface1 myInterface = new MyClass())
  25. {
  26. myInterface.DoSomething();
  27. }
  28. }
  29. }
  30.  
Success #stdin #stdout 0.03s 33864KB
stdin
Standard input is empty
stdout
I'm doing something...
Bye bye!