-
Notifications
You must be signed in to change notification settings - Fork 18
/
Program.cs
53 lines (42 loc) · 962 Bytes
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
using System.Diagnostics.CodeAnalysis;
namespace Generics;
class Program
{
static void Main()
{
}
}
public class GenericBase1<T>
{
public T? Item { get; set; }
}
public class GenericBase2<TKey, TValue>
where TValue : class
{
public TKey? Key { get; set; }
public TValue? Value { get; set; }
}
public class NonGenericDerived : GenericBase1<string>
{
}
public class GenericDerived<T> : GenericBase1<T>
{
}
public class MixedDerived<T> : GenericBase2<string, T>
where T : class
{
}
public class SelfAsTypeArgument : IComparable<SelfAsTypeArgument>
{
public int CompareTo([AllowNull] SelfAsTypeArgument other) => throw new NotImplementedException();
}
public class Curious<T>
where T : Curious<T>
{
}
// This is for illustration - these types are defined by .NET so we don't need to provide
// our own definition
#if false
public interface IEnumerable<out T> : IEnumerable
public interface IComparer<in T>
#endif