You should create a base class or interface that Circle
, Rectangle
, and Triangle
inherit from.
For example:
interface IShape
{
}
class Circle : IShape
{
// ...
}
class Rectangle : IShape
{
// ...
}
class Triangle : IShape
{
// ...
}
Then do the constraint on IShape
:
public class MyClass <L>
where L : IShape