Advertisement
Guest User

Untitled

a guest
Jan 24th, 2020
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.86 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApp1
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             _ = new Foo<IWrapped<int>>();
  14.         }
  15.     }
  16.  
  17.     public interface IWrapped<T>
  18.     {
  19.         T Value { get; }
  20.     }
  21.  
  22.     public class WrappedInt : IWrapped<int>
  23.     {
  24.         public int Value { get; }
  25.  
  26.         public WrappedInt(int value)
  27.         {
  28.             this.Value = value;
  29.         }
  30.     }
  31.  
  32.     public class WrappedLong : IWrapped<long>
  33.     {
  34.         public long Value { get; }
  35.  
  36.         public WrappedLong(long value)
  37.         {
  38.             this.Value = value;
  39.         }
  40.     }
  41.  
  42.     public class Foo<T> where T : IWrapped<int>, IWrapped<long>
  43.     {
  44.         public Foo()
  45.         {
  46.         }
  47.     }
  48.  
  49.  
  50.  
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement