Language Basics C# Book

We can add constraints to generic type parameters with the following syntax.
where: constraint
The constraints can be the follows:
Constraint Meaning
where T : base-class Base class constraint
where T : interface Interface constraint
where T : class Reference-type constraint
where T : struct Value-type constraint
where T : new() Parameterless constructor constraint
where U : T Naked type constraint

using System;
class Shape{
}
class Rectangle: Shape{
}
class Circle: Shape{
}
class GenericClass where T : Shape{
}
class Test
{
static void Main()
{
GenericClass g = new GenericClass();
}
}

interface constraint

using System;
interface PrintTable{
void print();
}
class Rectangle : PrintTable
{
}
class GenericClass where T : PrintTable
{
}
class Test
{
static void Main()
{
GenericClass g = new GenericClass();
}
}