Class ListFavoringConstructorQuery
Selects public constructors ordered so that any constructor with arguments matching System.Collections.Generic.IList<T> are selected before any other public constructor.
Inheritance
Implements
Inherited Members
Namespace: AutoFixture.Kernel
Assembly: AutoFixture.dll
Syntax
public class ListFavoringConstructorQuery : IMethodQuery
Remarks
The main target of this IMethodQuery implementation is to pick System.Collections.ObjectModel.Collection`1.#ctor(System.Collections.Generic.IList{`0}) before any other constructor. This can be used to populate a Collection instance with a list 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.IList<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.