IT Community - Software Programming, Web Development and Technical Support

Late binding and Early binding

This is a discussion on Late binding and Early binding within the C# Programming forums, part of the Software Development category; Hui Buddies can anybody let me know What is late binding and early binding? What is the benefits and disadvantages ...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Software Development > C# Programming

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 08-01-2007, 05:03 AM
vigneshgets vigneshgets is offline
D-Web Genius
 
Join Date: Mar 2007
Posts: 904
vigneshgets is on a distinguished road
Question Late binding and Early binding

Hui Buddies can anybody let me know What is late binding and early binding? What is the benefits and disadvantages of using them?
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 08-01-2007, 05:15 AM
H2o H2o is offline
D-Web Analyst
 
Join Date: Jul 2007
Posts: 246
H2o is on a distinguished road
Thumbs up Re: Late binding and Early binding

Vignesh,

Early Binding means compiler must have prior knowledge about COM, its functions and properties i.e. at compile time and so Visual Studio can use Intellisense to show you the methods and properties supported by COM while coding. So simply we can add reference of COM through 'Add Reference' from 'Solution Explorer'. After adding reference, you can use your COM just like .NET namespace that is by instancing your COM class as normal C# class instantiation.

Late Binding means compiler doesn't have any prior knowledge about COM's methods and properties and it is delayed until runtime. Normally program learns the addresses of methods and properties at execution time only i.e. when those methods and properties are invoked. Late bound code typically refers client objects through generic data types like 'object' and relies heavily on runtime to dynamically locate method addresses.

We do late binding in C# through reflection. Reflection is a way to determine the type or information about the classes or interfaces. We don't need to create RCW for the COM component in late binding as we did in early binding.

FYI: Early Binding and Late Binding are available both in VB.NET and C#.

I will get you the advantages & disadvantages soon
__________________
H2O

Without us, no one can survive..
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 08-01-2007, 05:31 AM
H2o H2o is offline
D-Web Analyst
 
Join Date: Jul 2007
Posts: 246
H2o is on a distinguished road
Smile Re: Late binding and Early binding

Vignesh,

Advantages of Early Binding:

1. Your code will run considerably faster, because it can all be compiled up front.

2. Debugging is far easier – select Debug + Compile, and the compiler will be able to spot syntax errors.

3. You have full access in your project to intellisense (you can type a keyword and a dot to get a popup list of properties and methods supported by that keyword, select one to insert it).

4.You have full access to the application's object model via the Object Browser and VBA Help.

5. You have access to the application's built-in constants.

All these advantages make programming using early binding immeasurably easier than using late binding.


Advantages of Late Binding:

The main advantage is that code which uses late binding is more certain to be version-independent

Dis-Advantages of Late Binding:

The more references your project contains and the larger the file size.

With late binding, the code relating to an application you declared as an object has to, in effect, be compiled as it runs ultimately leading to longer time for compilation.
__________________
H2O

Without us, no one can survive..
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to create Datatable which is very useful in binding.. Archer C# Programming 1 07-21-2007 01:12 AM
Runt, a giant, and a late collision vadivelanvaidyanathan Server Management 0 07-15-2007 06:46 PM
data binding nssukumar Flash Actionscript Programming 0 03-21-2007 02:58 AM
Data binding nssukumar Flash Actionscript Programming 0 03-16-2007 06:17 AM
note regarding data binding nssukumar Flash Actionscript Programming 0 03-14-2007 09:38 AM


All times are GMT -7. The time now is 09:14 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0