Class Likeness<T>
Provides convention-based object equality comparison for use when comparing two semantically equivalent objects.
Inheritance
Implements
Inherited Members
Namespace: SemanticComparison
Assembly: SemanticComparison.dll
Syntax
public class Likeness<T> : IEquatable<T>
Type Parameters
Name | Description |
---|---|
T | The type of the value which will be compared for equality. |
Constructors
| Improve this Doc View SourceLikeness(T)
Initializes a new instance of the Likeness<T> class with the supplied value.
Declaration
public Likeness(T value)
Parameters
Type | Name | Description |
---|---|---|
T | value | The value which will be compared for equality. |
Likeness(T, IEqualityComparer<T>)
Initializes a new instance of the Likeness<T> class with the supplied value.
Declaration
public Likeness(T value, IEqualityComparer<T> comparer)
Parameters
Type | Name | Description |
---|---|---|
T | value | The value which will be compared for equality. |
System.Collections.Generic.IEqualityComparer<T> | comparer | The comparer to support the comparison of objects for equality. |
Properties
| Improve this Doc View SourceValue
Gets the supplied value which will be compared for equality.
Declaration
public T Value { get; }
Property Value
Type | Description |
---|---|
T | The supplied value which will be compared for equality. |
Methods
| Improve this Doc View SourceEquals(T)
Determines whether the specified object is semantically equal to the current Value.
Declaration
public bool Equals(T other)
Parameters
Type | Name | Description |
---|---|---|
T | other | The object to compare against Value. |
Returns
Type | Description |
---|---|
System.Boolean | true if |
Equals(Object)
Determines whether the specified System.Object is semantically equal to the current Value.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj | The object to compare against Value. |
Returns
Type | Description |
---|---|
System.Boolean | true if |
Overrides
GetHashCode()
Serves as a hash function for Likeness<T>.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 | The hash code for Value, or 0 if the value is null. |
Overrides
ToResemblance()
Turns the Likeness<T> into a Resemblance by dynamically emitting a derived class that overrides Equals in the way that the Likeness<T> (re)defines equality.
Declaration
public T ToResemblance()
Returns
Type | Description |
---|---|
T | A dynamically emitted derived class that overrides Equals in the way that the Likeness<T> (re)defines equality. |
Exceptions
Type | Condition |
---|---|
ProxyCreationException |
ToString()
Returns a System.String that represents the contained object.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | A System.String representation of the contained object. |