static void Main(string[] args) { IRectangle obj = serviceProvider.GetRequiredService <Rectangle>(); obj.Draw(DrawApiType.OpenGL); Console.ReadLine(); // obj.DrawType(DrawApiType.SVG); }