c# array property get set code example
Example 1: 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;
}
}
}
Example 2: c# reflection get property value array
Array a = (Array)propertyInfo.GetValue(data);
for(int i = 0; i< a.Length; i++)
{
object o = a.GetValue(i);
}