Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

Design Patterns Used by Reflection Classes

The most commonly used methods in the System.Reflection namespace use a consistent pattern. The members of the Module, Type, and MemberInfo classes use the design patterns shown in the following table.

Member signature


MyInstance[] FindXxx(filter, filterCriteria)

Finds and returns a filtered list of types, or an empty array if no types matching the filter are implemented by the current type.

Example: Type.FindInterfaces

MyInstance GetXxx(<parameters>)

Returns the type that is uniquely specified by <parameters>. If no such type exists, the member returns a null reference (Nothing in Visual Basic). Note that <parameters> uniquely specifies an instance.

Example: Type.GetInterface

MyInstance[] GetXxxs()

Returns all the public types. If no public types exist, the member returns an empty array.

Example: Type.GetFields

MyInstance[] GetXxxs(<parameters>)

Returns all the types specified by <parameters>. If no such types exist, the member returns an empty array. Note that <parameters> does not necessarily specify a unique instance.

Another common design pattern is the use of delegates. They are typically used in reflection to enable filtering of the results set for methods that return arrays of objects.

Community Additions

© 2015 Microsoft