Class Indexer<T>
Indexed objects comparer
Hint: Objects can be indexed by annotation attribute IndexAttribute
Inherited Members
Namespace: XData.Extensions
Assembly: XData.docfx.dll
Syntax
public class Indexer<T> : IIndexer, IComparer<T>, IEqualityComparer<T>
Type Parameters
Name | Description |
---|---|
T | Indexed object type |
Constructors
| Improve this Doc View SourceIndexer(String)
Indexer parametrized constructor
Declaration
public Indexer(string propertyName)
Parameters
Type | Name | Description |
---|---|---|
String | propertyName | Comparable property name |
Methods
| Improve this Doc View SourceCompare(T, T)
Compares two objects and returns a value indicating whether one is less than, equal to, or greater than the other.
Declaration
public int Compare(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 |
---|---|
Int32 | A signed integer that indicates the relative values of |
Exceptions
Type | Condition |
---|---|
XDataRuntimeException | IndexedAttribute not found |
Equals(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 |
---|---|
Boolean | true if the specified objects are equal; otherwise, false. |
Exceptions
Type | Condition |
---|---|
XDataRuntimeException | IndexedAttribute not found |
GetHashCode(T)
Returns a hash code for the specified object.
Declaration
public int GetHashCode(T obj)
Parameters
Type | Name | Description |
---|---|---|
T | obj | The Object for which a hash code is to be returned. |
Returns
Type | Description |
---|---|
Int32 | A hash code for the specified object. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | The type of |
XDataRuntimeException | IndexedAttribute not found |
GetInstance()
Singleton comparer instance
Declaration
public static Indexer<T> GetInstance()
Returns
Type | Description |
---|---|
Indexer<T> | Comparer instance |