Definition - What does Early Binding mean?
In C#, early binding is a process in which a variable is assigned to a specific type of object during its declaration to create an early-bound object. This contrasts the late-bound object process, where an object type is revealed at the time of instantiation.
Early binding is implemented in a number of C# concepts, such as overloaded methods, overloaded operators and overridden methods, which are directly called via the use of derived objects. Early binding is not flexible and can result in version compatibility issues, due to the high dependency of property and method types and parameters.
Early binding is also known as compile time polymorphism, static binding and static typing.
Techopedia explains Early Binding
Early binding benefits include:
- The compiler can perform optimization, which results in more efficient applications
- Early-bound objects are faster, have better code readability and are easily maintained.
- Using Visual Studio's integrated development environment (IDE) as a development tool, early binding aids in rapid application development (RAD) by providing quick access to object properties and methods - reducing typographical errors.
- Errors are revealed during compilation, which reduces runtime error severity and frequency.
During early binding, the C# compiler performs syntax and type checks to ensure that the correct parameter amount and type are passed to the method or property. Early binding also checks for the return value, which minimizes execution time and runtime errors.
For example, a C# automation client application needs to calculate a value with a defined Microsoft Excel formula. The application may create an object of type Microsoft Excel and call its required method after initializing the object properties. Because Microsoft Excel is a specific type of object, the created and assigned variable is an early-bound object.
While working with early-bound objects, it is necessary to include the type library where the definitions of early-bound object types are defined. Additionally, an early-bound object cannot be used to assign an object of another type after its declaration.
Join thousands of others with our weekly newsletter
Free Whitepaper: The Path to Hybrid Cloud:
Free E-Book: Public Cloud Guide:
Free Tool: Virtual Health Monitor:
Free 30 Day Trial – Turbonomic: