Assigning

After a variable has been declared (and initialised with its default value) it can be assigned a different value.
Most script languages use late binding, and compiled languages use early binding.


Early Binding

Also known as Static Binding
It recognizes and checks the methods, or properties during compile time.
Non-virtual methods are always early bound.
Everything is early bound in C# unless you go through the Reflection interface.



Late Binding

Added .NET Framework 4.0
Also known as Dynamic Binding
Here the compiler does not know about what kind of object it is and what the methods or properties are until run-time.
Late binding is achieved by using virtual methods.
The performance of late binding is slower than early binding because it requires lookups at run-time.
Virtual methods are always late bound


Prior to that you could use the reflection API to do it.


VB.Net

VB.NET supports implicit late binding when Option Strict is off.
An object is late bound when it is assigned to a variable declared to be of type Object.
The VB compiler inserts code to bind to the right method at execution time and to catch invalid calls.
C# does not support this feature.



© 2022 Better Solutions Limited. All Rights Reserved. © 2022 Better Solutions Limited TopPrevNext