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 : IComparer<IDataModel>
- Inheritance:
- Object Object
Constructors
DataModelSortComparer()
public DataModelSortComparer()
Properties
CanCompareDisplayName
Gets or sets whether display name can be compared.
public bool CanCompareDisplayName { get; set; }
Property Value
- Boolean:
true
if 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
- Boolean:
true
if 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
- Boolean:
true
if 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
- Boolean:
true
if 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
- Int32:
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
- Int32:
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
- Int32:
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
- Int32:
A value indicating whether one is less than, equal to or greater than the other.
CompareSortOrder(Int32, Int32)
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 | Int32 | First object to compare. |
right | Int32 | Second object to compare. |
Returns
- Int32:
A value indicating whether one is less than, equal to or greater than the other.