IDataStore<TModel>.Item[int] Property
.NET Standard 2.x
Gets and sets the data row from the index location.
Namespace: DWNet.Data
Assembly: DWNet.Data.dll
Syntax
TModel this[int index] { get; set; }
Parameters
index
System.Int32
The index position of the row.
Property Value
TModel
Data row at the specified index position.
Examples
The following code example demonstrates how to use the Item
property.
using Appeon.ApiDoc.Models;
using DWNet.Data;
using System;
namespace Appeon.ApiDoc.IDataStore_GenericExamples
{
public class ItemExample
{
private readonly SchoolContext _context;
public ItemExample(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();
// Gets the first row of data in the DataStore.
var department = datastore[0];
Console.WriteLine("Departmentid:{0},Name:{1},Budget:{2},Startdate:{3},Administrator:{4}",
department.Departmentid, department.Name, department.Budget,
department.Startdate, department.Administrator);
/*This code produces the following output:
Departmentid:1, Name:Engineering, Budget:220000.0000,
Startdate: 2007/9/1 00:00:00, Administrator:2
*/
}
}
}
Example Refer To
Model Class: D_Department
DataWindow File: d_department