Does an Enum exist for Asc or Desc ordering?

前端 未结 5 708
后悔当初
后悔当初 2021-02-03 17:53

Is there an Enum natively in .NET for asceding or Desceding ordering?

I need to use the ordering concept in different libraries, and I want loose coupling as possible.

5条回答
  •  没有蜡笔的小新
    2021-02-03 18:23

    SortOrder and ListSortDirection are two valid choices but keep in mind this:

    ListSortDirection:

    • available in .net verions 1.1 to 4 and silverlight.
    • the sort order is mandatory: ListSortDirection has only "Ascending" and "Descending" options so the user has too choose one of them.

    SortOrder:

    • available only in .net versions 3.5 and 4. No support for silverlight.
    • sort order is optional: you also have the "Unspecified" option.

提交回复
热议问题