how to use a getter and a setter on an array C# code example
Example: get and set for array c#
// Automatically
public class Customer
{
public string CustomerName { get; set; }
public double[] TotalPurchasesLastThreeDays { get; set; }
}
// ----------------------- OR ---------------------------
// Manually
public class Customer
{
private double[] totalPurchasesLastThreeDays;
public string CustomerName { get; set; }
public double[] TotalPurchasesLastThreeDays
{
get
{
return totalPurchasesLastThreeDays;
}
set
{
totalPurchasesLastThreeDays = value;
}
}
}