Reviewing the Binder Class

Reviewing the Binder Class

The Binder class is an abstract class that you must inherit from to use. Binders are used to perform type conversions. The InvokeMember method of Type objects can accept a Binder object that describes how to perform type conversions between the types of arguments passed to InvokeMember and the actual types needed by the member being invoked.

To create a binder you will need to inherit from System.Reflection.Binder and override BindToMethod , BindToField , SelectMethod , SelectProperty , and ChangeType .

TIP

The System.Type class has a DefaultBinder property you can use if you need a binder but don't need special binding behavior.

In addition to being used to bind methods for dynamically invoking members , binders are used in other contexts. ASP.NET uses binding to bind the results of functions and properties to controls on a Web page. (Refer to the help documentation on the Binder class for a long example of a custom binder.)



Visual Basic. NET Power Coding
Visual Basic(R) .NET Power Coding
ISBN: 0672324075
EAN: 2147483647
Year: 2005
Pages: 215
Authors: Paul Kimmel

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net