Advertisement
Guest User

Untitled

a guest
Feb 12th, 2016
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Threading.Tasks;
  5.  
  6. namespace Variance
  7. {
  8. public class Program
  9. {
  10. public static void Main(string[] args)
  11. {
  12. IEnumerable<IBar> fooBar = GetBar();
  13.  
  14. foreach(FooBar element in fooBar)
  15. {
  16.  
  17. }
  18. }
  19.  
  20. public static IEnumerable<IBar> GetBar()
  21. {
  22. return new List<IBar> { new FooBar(), new FooBar(), new FooBar() };
  23. }
  24. }
  25.  
  26. public interface IFoo
  27. {
  28. void DoFoo();
  29. }
  30.  
  31. public interface IBar
  32. {
  33. void DoBar();
  34. }
  35.  
  36. public class FooBar : IFoo, IBar
  37. {
  38. public void DoFoo() { }
  39.  
  40. public void DoBar() { }
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement