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
Indicates 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
Indicates 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
Indicates 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
Indicates 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 | |
| right | IDataModel |
Returns
- int:
A signed integer that indicates the relative values of
xandy, as shown in the following table.Value Meaning Less than zero xis less thany.Zero xequalsy.Greater than zero xis greater thany.
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.
Inherited Members
- object.GetType()
- object.MemberwiseClone()
- object.ToString()
- object.Equals(object)
- object.Equals(object, object)
- object.ReferenceEquals(object, object)
- object.GetHashCode()