c# get and set for arrays code example
Example 1: how to store array in c#
int[] arr = new int[5]
arr[0] = 1;
arr[1] = 2;
arr[2] = 3;
arr[3] = 4;
arr[4] = 5;
Example 2: get and set for array c#
public class Customer
{
public string CustomerName { get; set; }
public double[] TotalPurchasesLastThreeDays { get; set; }
}
public class Customer
{
private double[] totalPurchasesLastThreeDays;
public string CustomerName { get; set; }
public double[] TotalPurchasesLastThreeDays
{
get
{
return totalPurchasesLastThreeDays;
}
set
{
totalPurchasesLastThreeDays = value;
}
}
}