We've divided the capabilities of Fasterflect into two buckets called Querying and Accessing. Querying covers the run-time inspection of assemblies and types, and is essentially everything that does not create or modify data. On the following pages you'll learn how to use Fasterflect for inspecting assemblies and types, including locating and extracting metadata from attributes.

The Standard Queries page documents the functionality of Fasterflect that is also available with standard reflection. Querying capabilities that go beyond what you can do with standard reflection are documented on the Advanced Queries page.

Before you read on please make sure that you have read the Getting Started page, in particular the section on how to customize the behavior of Fasterflect using Flags.


We've tried to make both naming and behavior in Fasterflect as consistent as possible. This allows you to rely on a few conventions when using the library as explained below.

Naming conventions

Query methods are named after the item type that they return. Methods that return a single item will use the singular form whereas methods that return multiple items will use the plural form. For instance, a method called Field will locate a single field whereas a method called Properties will locate one or more properties.

Conventions for return values

Queries that return a single item will either return the requested item if it was found or null if no match was found. Queries for multiple items will always return an instance implementing IList<T>, which implies that you do not need to check the return values for null. This provides great convenience when iterating over results as you can skip checks for null before enumerating using foreach or doing a LINQ query. It should be noted that the actual type will be either T[] or List<T> depending on the query, and that it is therefore not safe to add or remove elements from the list (since arrays are of fixed size an exception will be thrown if you try to add an element).

Parameter conventions

Query methods that accept an optional list of parameters (that is, where the last argument is an array declared with the params keyword) will treat null and the empty list identically. For instance, if the optional parameter is a list of names against which to filter the result then passing an the empty list will not cause any name filtering to be applied.

Additionally, if a query method has been overloaded to accept a Flags parameter (to customize how the search is performed) then all overloads that do not have this parameter will be using Flags.InstanceAnyVisibility as its default value.

Reflection entry points

There are essentially only two starting points for using reflection to discover information. Either your starting point is an assembly, in which case you probably want to locate one or more types within that assembly, or your starting point is a type, in which case you could want to do a variety of different tasks. All of the querying capabilities in Fasterflect are therefore implemented as extension methods for the types Assembly and Type. This implies that to reflect on some object instance you should first call GetType() to obtain the type.

Reflection metadata classes

Although Fasterflect provides its own API for querying, this is implemented on top of the standard reflection capabilities. This means that Fasterflect returns the same Info classes as standard reflection would, and it is therefore essential that you have some basic knowledge of these. Microsoft provides a nice introduction to these on the Reflection Overview page on MSDN.


  • Standard Queries Explains how Fasterflect can be used as a replacement for standard Reflection lookup operations
  • Advanced Queries Explains the Fasterflect querying capabilities not available with standard Reflection

Last edited Mar 5, 2010 at 12:54 AM by mertner, version 8


No comments yet.