Show / Hide Table of Contents

    IDataStore.RemoveAt(int index) Method

    .NET Standard 2.x

    Removes the row according to the specified index from the primary buffer of the DataStore. The index is the same as the zero-based row number.

    Namespace: DWNet.Data

    Assembly: DWNet.Data.dll

    Syntax

      public void RemoveAt(int index);
    

    Parameters

    index System.Int32

    The zero-based index of the row to remove.

    Remarks

    The RemoveAt method will call the OnRowDeleting method before removing the row, and then call the OnRowDeleted method after removing the row.

    Examples

    The following code example demonstrates how to remove the DataStore record according to the specified index number.

    using DWNet.Data;
    using System;
    
    namespace Appeon.ApiDoc.IDataStoreExamples
    {
        public class RemoveAtExample
        {
            private readonly SchoolContext _context;
    
            public RemoveAtExample(SchoolContext dataContext)
            {
                // Sets the data context
                _context = dataContext;
            }
    
            public void Example()
            {
                // Instantiates a DataStore object with datawindow: d_department.
                var datastore = new DataStore("d_department", _context);
    
                datastore.Retrieve();
    
                Console.WriteLine("Before RemoveAt, Rowcount: {0}", datastore.RowCount);
    
                // Removes the first record of datastore
                datastore.RemoveAt(0);
    
                Console.WriteLine("After RemoveAt, Rowcount: {0}", datastore.RowCount);
    
                /*This code produces the following output:
                 
                Before RemoveAt, Rowcount: 4
                After RemoveAt, Rowcount: 3
                */
            }
        }
    }
    

    Example Refer To

    Model Class: D_Department
    DataWindow File: d_department

    Applies to

    .NET Standard

    2.x

    Back to top Generated by Appeon