Question - What is the difference between late binding and early binding in C#?
Answer -
Late binding and early binding are examples of one of the primary concepts of OOPS: Polymorphism.
For ex: one function calculateBill() will calculate bills of premium customers, basic customers, and semi-premium customers based on their policies differently. The calculation for all the customer objects is done differently using the same function which is called polymorphism.
When an object is assigned to an object variable in C#, the .NET framework performs the binding.
When the binding function happens at compile-time, it is called early binding. It investigates and checks the methods and properties of the static objects. With early binding, the number of run-time errors decreases substantially and it executes pretty quickly.
But when the binding happens at runtime, it is called late binding. Late binding happens when the objects are dynamic (decided based on the data they hold) at run-time. It is slower as it looks through during run-time.