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