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.. |