Class FieldTypeAndNameCriterion
Namespace: AutoFixture.Kernel
Assembly: AutoFixture.dll
Represents a criterion for comparing a candidate field against a desired type and name.
public class FieldTypeAndNameCriterion : IEquatable<FieldInfo>Inheritance
object ← FieldTypeAndNameCriterion
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 `FieldInfo` values, looking for one that has a desired field type and name. This class represents such an evaluation criterion.
Constructors
FieldTypeAndNameCriterion(IEquatable<Type>, IEquatable<string>)
Initializes a new instance of the
FieldTypeAndNameCriterion class with the desired
field type and name criteria.
public FieldTypeAndNameCriterion(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(FieldInfo)
Compares a candidate FieldInfo object against this
FieldTypeAndNameCriterion.
public bool Equals(FieldInfo other)Parameters
other FieldInfo
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 field'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
FieldTypeAndNameCriterion.Equals(FieldInfo), Criterion<T>, ParameterTypeAndNameCriterion, PropertyTypeAndNameCriterion