The process of locating a type declaration and verifying that its methods are used correctly is called binding. Binding that occurs at compile time is called early binding. When it happens at runtime, it is known as late binding.
Visual Basic .NET uses reflection to implement late binding. Consider the following code:
Dim fourOneOne As Object fourOneOne = New ServerInfo( ) fourOneOne.DoTask(Allocate2GigForTheBrowser)
Here, fourOneOne is declared as an Object but instantiated as ServerInfo (from Example 7-1). The DoTask method call is a late-bound call. In situations like this, the method is called at runtime through the Type.InvokeMember method. Try to avoid writing code like this, if possible. You will incur a performance penalty for late binding.
In more exotic architectures, especially distributed systems, late binding is a must. Think about a system centered around SOAP, for instance. A SOAP envelope that describes an object and a method call is sent to a server located halfway around the world. The remote server spawns an instance of the object, calls the appropriate method, and sends the results back to the caller. This is late binding at the extreme!
Reflection not only allows you to inspect the types contained within an assembly, it makes it possible for you to create instances of those types at runtime. You can then call methods on those objects and use them just like any other objects.
Loading a ...