Show / Hide Table of Contents

    IDataStoreBase.Index Property

    .NET Standard 2.x

    Gets the index of the current row when traversing DataStore.

    Namespace: DWNet.Data

    Assembly: DWNet.Data.dll

    Syntax

      public int Index { get; }
    

    Property Value

    System.Int32

    The index of the current row when traversing DataStore.

    Remarks

    This method can be used together with DataStore.MoveNext to get all of the data rows by traversing DataStore.

    Examples

    The following code example demonstrates how to use the Index property to get the index number of the first row.

    using DWNet.Data;
    using System;
    
    namespace Appeon.ApiDoc.IDataStoreBaseExamples
    {
        public class IndexExample
        {
            private readonly SchoolContext _context;
    
            public IndexExample(SchoolContext dataContext)
            {
                // Sets the data context
                _context = dataContext;
            }
    
            public void Example()
            {
                // Instantiates datastore with datawindow: d_department.
                var datastore = new DataStore("d_department", _context);
    
                datastore.Retrieve();
    
                Console.WriteLine("Retrieved Rowcount: {0}",
                    datastore.RowCount);
    
                // Selects the first row.
                datastore.MoveNext();
    
                // Gets the index number of the first row.
                int index = datastore.Index;
    
                Console.WriteLine("The index of the current row is: {0}", index);
    
                /*This code produces the following output:
                
                Retrieved Rowcount: 4
                The index of the current row is: 0   
                */
            }
        }
    }
    

    Example Refer To

    Model Class: D_Department
    DataWindow File: d_department

    Applies to

    .NET Standard

    2.x

    Back to top Generated by Appeon