IDataStore<TModel>.Reverse(int index, int count) Method
.NET Standard 2.x
Reverses the order of the elements in the specified range.
Namespace: DWNet.Data
Assembly: DWNet.Data.dll
Syntax
void Reverse(int index, int count);
Parameters
index
System.Int32
The zero-based index of the starting position to reverse.
count
System.Int32
The number of elements to reverse.
Examples
The following code example demonstrates how to reverse the specified number of rows, from the sepcified starting position.
using Appeon.ApiDoc.Models;
using DWNet.Data;
using System;
namespace Appeon.ApiDoc.IDataStore_GenericExamples
{
public class ReverseExample
{
private readonly SchoolContext _context;
public ReverseExample(SchoolContext dataContext)
{
// Sets the data context
_context = dataContext;
}
public void Example2()
{
// Instantiates a DataStore object with datawindow: d_department.
var datastore = new DataStore<D_Department>(_context);
datastore.Retrieve();
Console.WriteLine("Before Reverse, DepartmentID: ",
datastore.GetModel(0).Departmentid);
// Inverts the position of the first and the second element,
// Starting from 0, a total of two rows.
datastore.Reverse(0, 2);
Console.WriteLine("After Reverse, DepartmentID: ",
datastore.GetModel(0).Departmentid);
/*This code produces the following output:
Before Reverse, DepartmentID: 1
After Reverse, DepartmentID: 2
*/
}
}
}
Example Refer To
Model Class: D_Department
DataWindow File: d_department