DataModelSortComparer Class
Provides a comparer implementation for sorting IDataModel objects in order of sort importance, sort order, numeric display name index (if applicable), and finally display name.
public class DataModelSortComparer
- Inheritance:
- object object
Constructors
DataModelSortComparer()
Initializes an instance of the class.
public DataModelSortComparer()
Properties
CanCompareDisplayName
Gets or sets whether display name can be compared.
public bool CanCompareDisplayName { get; set; }
Property Value
- bool:
trueif display name can be compared; otherwise,false. The default value istrue.
CanCompareIndex
Gets or sets whether a numeric index value (e.g. [0]) in the display name can be compared.
public bool CanCompareIndex { get; set; }
Property Value
- bool:
trueif a numeric index value (e.g.[0]) in the display name can be compared; otherwise,false. The default value istrue.
CanCompareSortImportance
Gets or sets whether sort importance can be compared.
public bool CanCompareSortImportance { get; set; }
Property Value
- bool:
trueif sort importance can be compared; otherwise,false. The default value istrue.
CanCompareSortOrder
Gets or sets whether sort order can be compared.
public bool CanCompareSortOrder { get; set; }
Property Value
- bool:
trueif sort order can be compared; otherwise,false. The default value istrue.
Methods
Compare(IDataModel, IDataModel)
Compares two objects and returns a value indicating whether one is less than, equal to or greater than the other.
public virtual int Compare(IDataModel left, IDataModel right)
| Parameter | Type | Description |
|---|---|---|
| left | IDataModel | First object to compare. |
| right | IDataModel | Second object to compare. |
Returns
- int:
A value indicating whether one is less than, equal to or greater than the other.
CompareDisplayName(string, string)
Compares two DisplayName values and returns a value indicating whether one is less than, equal to or greater than the other.
protected virtual int CompareDisplayName(string left, string right)
| Parameter | Type | Description |
|---|---|---|
| left | string | First object to compare. |
| right | string | Second object to compare. |
Returns
- int:
A value indicating whether one is less than, equal to or greater than the other.
CompareIndex(string, string)
Compares two DisplayName values to see if they contain numeric indices (e.g. [0]) and returns a value indicating whether one is less than, equal to or greater than the other.
protected virtual int CompareIndex(string left, string right)
| Parameter | Type | Description |
|---|---|---|
| left | string | First object to compare. |
| right | string | Second object to compare. |
Returns
- int:
A value indicating whether one is less than, equal to or greater than the other.
CompareSortImportance(DataModelSortImportance, DataModelSortImportance)
Compares two SortImportance values and returns a value indicating whether one is less than, equal to or greater than the other.
protected virtual int CompareSortImportance(DataModelSortImportance left, DataModelSortImportance right)
| Parameter | Type | Description |
|---|---|---|
| left | DataModelSortImportance | First object to compare. |
| right | DataModelSortImportance | Second object to compare. |
Returns
- int:
A value indicating whether one is less than, equal to or greater than the other.
CompareSortOrder(int, int)
Compares two SortOrder values and returns a value indicating whether one is less than, equal to or greater than the other.
protected virtual int CompareSortOrder(int left, int right)
| Parameter | Type | Description |
|---|---|---|
| left | int | First object to compare. |
| right | int | Second object to compare. |
Returns
- int:
A value indicating whether one is less than, equal to or greater than the other.