Reputation: 4318
I have a List of Microsoft.WindowsAzure.Storage.Table.DynamicTableEntity that I need to sort. Although List
provides me a Sort()
method, DynamicTableEntity
does not have a default comparator. As it is a sealed
class, I can't seem to create my own.
I want to sort on DynamicTableEntity.RowKey.
What would be the most efficient way to sort this list? Should I roll my own sorting method or should I try to use some sort of Linq query, or is there something I'm missing?
Upvotes: 0
Views: 200
Reputation: 6175
You should be able to use the Sort
override that has the Comparison<T>
delegate.
Something like this:
entities.Sort((x,y) => /*Code to compare your two entities */);
Knowing that the delegate should return an int
with the following rule:
The simple types already implement a CompareTo method that you're likely to be able to use.
Upvotes: 2