Q:

get and set for array c#

class Person
{
  private string name; // field

  public string Name   // property
  {
    get { return name; }   // get method
    set { name = value; }  // set method
  }
} 
20
// 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;
            }
        }
    }
0

New to Communities?

Join the community