SIGN UP MEMBER LOGIN:    
ARTICLE

Early Binding vs. Late Binding

Posted by Manikavelu Velayutham Articles | Current Affairs September 20, 2010
Before discussing about the differences, let's know what is meant by Early and Late Binding.
Reader Level:

HTML clipboard

Before discussing about the differences, let's know what is meant by Early and Late Binding.

Early Binding

The name itself describes that compiler knows about what kind of object it is, what are all the methods and properties it contains. As soon as you declared the object, .NET Intellisense will populate its methods and properties on click of the dot button.

Common Examples:

  • ComboBox cboItems;

  • ListBox lstItems;

In the above examples, if we type the cboItem and place a dot followed by, it will automatically populate all the methods, events and properties of a combo box, because compiler already know it's an combobox.

Late Binding

The name itself describes that compiler does not know what kind of object it is, what are all the methods and properties it contains. You have to declare it as an object, later you need get the type of the object, methods that are stored in it. Everything will be known at the run time.

Common Examples:

  • Object objItems;

  • objItems = CreateObject("DLL or Assembly name");

Here during the compile time, type of objItems is not determined. We are creating an object of a dll and assigning it to the objItems, so everything is determined at the run time.

Early Binding vs. Late Binding

Now coming into the picture…

  • Application will run faster in Early binding, since no boxing or unboxing are done here.

  • Easier to write the code in Early binding, since the intellisense will be automatically populated

  • Minimal Errors in Early binding, since the syntax is checked during the compile time itself.

  • Late binding would support in all kind of versions, since everything is decided at the run time.

  • Minimal Impact of code in future enhancements, if Late Binding is used.

  • Performance will be code in early binding.

Both have merits and demerits, it's the developer decision to choose the appropriate binding based on the scenario.

Login to add your contents and source code to this article
share this article :
post comment
 
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor
PREMIUM SPONSORS
  • ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications. Visit DynamicPDF here
    Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
Become a Sponsor