Devirtualize generic method calls
I have this interface:
interface IDrawable
{
void Draw();
}
and then I have this class:
sealed class Circle : IDrawable {...}
and this:
class Canvas<T> where T : IDrawable
{
public Canvas(T[] items)
{
foreach (T item in items)
{
item.Draw();
}
}
}
Now, the Circle class is sealed, so if I do:
new Canvas<Circle>(circles)
will the Draw calls be devirtualized?
If they won't, is there a way to make it, WITHOUT switching Circle from class to struct?
Thanks in advance.