Class ArrayFavoringConstructorQuery

Namespace: AutoFixture.Kernel
Assembly: AutoFixture.dll

Selects public constructors ordered so that any constructor with array arguments are selected before any other public constructor.

public class ArrayFavoringConstructorQuery : IMethodQuery

Inheritance

objectArrayFavoringConstructorQuery

Implements

IMethodQuery

Inherited Members

object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Remarks

The main target of this IMethodQuery implementation is to pick constructors with array arguments before any other constructor.

Constructors

ArrayFavoringConstructorQuery()

public ArrayFavoringConstructorQuery()

Methods

SelectMethods(Type)

Selects the constructors for the supplied type.

public IEnumerable<IMethod> SelectMethods(Type type)

Parameters

type Type

The type.

Returns

IEnumerable<IMethod>

All public constructors for type, giving priority to any constructor with one or more array arguments.

Remarks

Given several constructors, this implementation will favor those constructors which contain array arguments. Constructors with most matching arguments are returned before constructors with less matching arguments.

Any other constructors are returned with the most modest constructors first.

See Also

ArrayFavoringConstructorQuery