Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Threading.Tasks;
- namespace Variance
- {
- public class Program
- {
- public static void Main(string[] args)
- {
- IEnumerable<IBar> fooBar = GetBar();
- foreach(FooBar element in fooBar)
- {
- }
- }
- public static IEnumerable<IBar> GetBar()
- {
- return new List<IBar> { new FooBar(), new FooBar(), new FooBar() };
- }
- }
- public interface IFoo
- {
- void DoFoo();
- }
- public interface IBar
- {
- void DoBar();
- }
- public class FooBar : IFoo, IBar
- {
- public void DoFoo() { }
- public void DoBar() { }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement