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:
- System.Object Object
Constructors
DataModelSortComparer()
public DataModelSortComparer()
Properties
CanCompareDisplayName
Gets or sets whether display name can be compared.
public bool CanCompareDisplayName { get; set; }
Property Value
- System.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
- System.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
- System.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
- System.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
- System.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 | System.String | First object to compare. |
right | System.String | Second object to compare. |
Returns
- System.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 | System.String | First object to compare. |
right | System.String | Second object to compare. |
Returns
- System.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
- System.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 | System.Int32 | First object to compare. |
right | System.Int32 | Second object to compare. |
Returns
- System.Int32:
A value indicating whether one is less than, equal to or greater than the other.
Inherited Members
- System.Object.ToString()
- System.Object.Equals(System.Object)
- System.Object.Equals(System.Object, System.Object)
- System.Object.ReferenceEquals(System.Object, System.Object)
- System.Object.GetHashCode()
- System.Object.GetType()
- System.Object.MemberwiseClone()