Class SemanticComparer<T>
Provides a class which implements the System.Collections.Generic.IEqualityComparer<T> interface for 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 SemanticComparer<T> : IEqualityComparer<T>, IEqualityComparer
Type Parameters
Name | Description |
---|---|
T | The type of the value which will be compared for equality. |
Remarks
This class is a boolean 'And' Composite over IMemberComparer instances.
Constructors
| Improve this Doc View SourceSemanticComparer()
Initializes a new instance of the SemanticComparer<T> class.
Declaration
public SemanticComparer()
SemanticComparer(IMemberComparer[])
Initializes a new instance of the SemanticComparer<T> class.
Declaration
public SemanticComparer(params IMemberComparer[] comparers)
Parameters
Type | Name | Description |
---|---|---|
IMemberComparer[] | comparers | The supplied array of IMemberComparer instances. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | comparers is null |
SemanticComparer(IEnumerable<IMemberComparer>)
Initializes a new instance of the SemanticComparer<T> class.
Declaration
public SemanticComparer(IEnumerable<IMemberComparer> comparers)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<IMemberComparer> | comparers | The supplied System.Collections.Generic.IEnumerable<T> instances. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | comparers is null |
Properties
| Improve this Doc View SourceComparers
Gets the supplied System.Collections.Generic.IEnumerable<T> instances.
Declaration
public IEnumerable<IMemberComparer> Comparers { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<IMemberComparer> | The supplied System.Collections.Generic.IEnumerable<T> instances. |
Methods
| Improve this Doc View SourceEquals(T, T)
Determines whether the specified objects are equal.
Declaration
public bool Equals(T x, T y)
Parameters
Type | Name | Description |
---|---|---|
T | x | The first object to compare. |
T | y | The second object to compare. |
Returns
Type | Description |
---|---|
System.Boolean | true if the specified objects are equal; otherwise, false. |
GetHashCode(T)
Returns a hash code for this instance.
Declaration
public int GetHashCode(T obj)
Parameters
Type | Name | Description |
---|---|---|
T | obj | The obj. |
Returns
Type | Description |
---|---|
System.Int32 | A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. |
Explicit Interface Implementations
| Improve this Doc View SourceIEqualityComparer.Equals(Object, Object)
Determines whether the specified objects are equal.
Declaration
bool IEqualityComparer.Equals(object x, object y)
Parameters
Type | Name | Description |
---|---|---|
System.Object | x | The first object to compare. |
System.Object | y | The second object to compare. |
Returns
Type | Description |
---|---|
System.Boolean | true if the specified objects are equal; otherwise, false. |
IEqualityComparer.GetHashCode(Object)
Returns a hash code for this instance.
Declaration
int IEqualityComparer.GetHashCode(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj | The obj. |
Returns
Type | Description |
---|---|
System.Int32 | A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. |