
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
An Advanced Member Search Mechanism
|
515
• A filter to search for all implemented interfaces that are loaded from the GAC:
public bool IfaceFilterCallback(Type type, object criteria)
{
if (type.Assembly.GlobalAssemblyCache)
{
return (true);
}
else
{
return (false);
}
}
• A filter to search for all implemented interfaces that are defined within an assem-
bly with the version number 1.0.3300.0:
public bool IfaceFilterCallback(Type type, object criteria)
{
if (type.Assembly.FullName.IndexOf("Version=1.0.3300.0") >= 0)
{
return (true);
}
else
{
return (false);
}
}
See Also
See Recipe 9.8; see the “Delegate Class” and “Type.FindInterfaces Method” topics in
the MSDN documentation.
9.8 An Advanced Member Search Mechanism
Problem
You are searching for a member within a type using the Type class. However, com-
plex member searches are not available through the
GetMember and GetMembers meth-
ods of a
Type object. The GetMember method searches for a member name only within
a type limited by the set of
BindingFlags used, and the GetMembers method searches
for all members limited by the set of
BindingFlags used. BindingFlags is an enumera-
tion of various member types that can be searched. The
BindingFlags related to this
recipe are defined here:
DeclaredOnly
Include members declared at the same level of the ...