
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
514
|
Chapter 9: Delegates, Events, and Anonymous Methods
each interface found.) This method then returns an array of interface types that
match the criterion.
The
TypeFilter delegate, filter, defines the IfaceFilterCallback method to be
called for each interface found on the
searchedType object. The real power of this
search mechanism lies in the
IfaceFilterCallback callback method.
This callback searches for each of the interface types in the
criteria array that is
implemented by the
searchedType parameter of the SearchInterfacesOfType method.
Discussion
The FindInterfaces method of a Type object makes use of the TypeFilter delegate,
which is passed to the
filter parameter. This delegate is supplied by the FCL and
allows an extra layer of filtering (of any type that you want) to occur. This delegate
returns a Boolean value, where
true indicates that the ifaceType object passed to this
delegate should be included in the
Type array that the FindInterfaces method
returns;
false indicates that this ifaceType object should not be included.
The FindInterfaces method will take into account all interfaces imple-
mented by the type being searched as well as all of its base types when
performing a search. In addition, if any of the interfaces implemented
by any of these types also implements one or more ...