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 ...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
| |||
| 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.. |
| |||
| 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.. |
![]() |
| Thread Tools | |
| Display Modes | |
| |
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 |