Class ParameterTypeAndNameCriterion
Namespace: AutoFixture.Kernel
Assembly: AutoFixture.dll
Represents a criterion for comparing a candidate parameter against a desired type and name.
public class ParameterTypeAndNameCriterion : IEquatable<ParameterInfo>Inheritance
object ← ParameterTypeAndNameCriterion
Implements
Inherited Members
object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Remarks
Sometimes, you may need to evaluate various candidate `ParameterInfo` values, looking for one that has a desired parameter type and name. This class represents such an evaluation criterion.
Constructors
ParameterTypeAndNameCriterion(IEquatable<Type>, IEquatable<string>)
Initializes a new instance of the
ParameterTypeAndNameCriterion class with the desired
field type and name criteria.
public ParameterTypeAndNameCriterion(IEquatable<Type> typeCriterion, IEquatable<string> nameCriterion)Parameters
typeCriterion IEquatable<Type>
The criterion indicating the desired field type.
nameCriterion IEquatable<string>
The criterion indicating the desired field name.
Exceptions
typeCriterion or
nameCriterion is null.
Properties
NameCriterion
The name criterion originally passed in via the class' constructor.
public IEquatable<string> NameCriterion { get; }Property Value
TypeCriterion
The type criterion originally passed in via the class' constructor.
public IEquatable<Type> TypeCriterion { get; }Property Value
Methods
Equals(ParameterInfo)
Compares a candidate ParameterInfo object against
this ParameterTypeAndNameCriterion.
public bool Equals(ParameterInfo other)Parameters
other ParameterInfo
The candidate to compare against this object.
Returns
true if other is deemed
equal to this instance; otherwise, false.
Remarks
This method compares the candidate other
against `TypeCriterion` and
`NameCriterion`. If the parameter's type matches the
type criterion, and its name matches the name criterion, the return
value is true.
Equals(object)
Determines whether this object is equal to another object.
public override bool Equals(object obj)Parameters
obj object
The object to compare to this object.
Returns
true if obj is equal to this
object; otherwise, false.
GetHashCode()
Returns the hash code for the object.
public override int GetHashCode()Returns
The hash code.
See Also
ParameterTypeAndNameCriterion.Equals(ParameterInfo), Criterion<T>, FieldTypeAndNameCriterion, PropertyTypeAndNameCriterion