Show / Hide Table of Contents

    IOrderable<TModel>.Sort() Method

    .NET Standard 2.x

    Sorts the object according to the collations you have set.

    Namespace: DWNet.Data

    Assembly: DWNet.Data.dll

    Syntax

      bool Sort();
    

    Returns

    System.Boolean

    Always returns true if it succeeds.

    Examples

    The following code example demonstrates how to sort the records in ModelStore.

    using Appeon.ApiDoc.Models.School;
    using DWNet.Data;
    
    namespace Appeon.ApiDoc.IOrderableExamples
    {
        public class SortExample
        {
            private readonly SchoolContext _context;
            public SortExample(SchoolContext context)
            {
                _context = context;
            }
    
            public void Example()
            {
                // Retrieves data for ModelStore
                var courses = new ModelStore<Course>();
                courses.Retrieve(_context);
    
                // Sets the sorting rule
                var order = courses.OrderBy(m => m.DepartmentID);
    
                // Sorts the data
                order.Sort();            
            }
        }
    }
    

    Example Refer To

    Model Class: Course

    Applies to

    .NET Standard

    2.x

    Back to top Generated by Appeon