The System.Windows.Documents List OrderByDescending is a method that is used to sort a collection of items in descending order. It is a part of the .NET Framework and is commonly used in C# programming language. This method allows developers to easily sort a list of documents by an attribute like their date or size, for example.
Here are some code examples:
Example 1: Sorting documents by size
List documents = GetDocuments(); List sortedDocuments = documents.OrderByDescending(d => d.Size).ToList();
In this example, we use OrderByDescending to sort a list of documents by their size. We first fetch the documents using the GetDocuments method and then call OrderByDescending on the collection. We pass in a lambda expression that returns the Size property of the document. The ToList() method is used to convert the sorted collection back to a list.
Example 2: Sorting documents by date
List documents = GetDocuments(); List sortedDocuments = documents.OrderByDescending(d => d.LastModifiedDate).ToList();
In this example, we sort the documents by their last modified date. We again fetch the documents using the GetDocuments method and then call OrderByDescending. This time, we pass in a lambda expression that returns the LastModifiedDate property of the document.
This method is a part of the System.Linq library, which is a part of the .NET Framework.
C# (CSharp) System.Windows.Documents List.OrderByDescending - 30 examples found. These are the top rated real world C# (CSharp) examples of System.Windows.Documents.List.OrderByDescending extracted from open source projects. You can rate examples to help us improve the quality of examples.