Class EnumerableFavoringConstructorQuery
Selects public constructors ordered so that any constructor with arguments matching System.Collections.Generic.IEnumerable<T> are selected before any other public constructor.
Inheritance
Implements
Inherited Members
Namespace: AutoFixture.Kernel
Assembly: AutoFixture.dll
Syntax
public class EnumerableFavoringConstructorQuery : IMethodQuery
Remarks
The main target of this IMethodQuery implementation is to pick System.Collections.Generic.List`1.#ctor(System.Collections.Generic.IEnumerable{`0}) before any other constructor. This can be used to populate a list instance with a sequence of items.
Methods
| Improve this Doc View SourceSelectMethods(Type)
Selects the constructors for the supplied type.
Declaration
public IEnumerable<IMethod> SelectMethods(Type type)
Parameters
Type | Name | Description |
---|---|---|
System.Type | type | The type. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<IMethod> | All public constructors for |
Remarks
Given several constructors, this implementation will favor those constructors with
arguments that matches System.Collections.Generic.IEnumerable<T>, where T is the item type of
type
, if it's generic. Constructors with most matching arguments are
returned before constructors with less matching arguments.
Any other constructors are returned with the most modest constructors first.