using System;
using System.Runtime.Serialization;

namespace Serialisierung
{
    [Serializable]
    public class Customer : IDeserializationCallback
    {
        private string firstname;
        private string lastname;
        private Product[] products;

        [NonSerialized]
        private int[] ordercounter; // = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };

        public int[] OrderCounter
        {
            get { return ordercounter; }
        }

        public Product[] Products
        {
            get { return products; }
            set { products = value; }
        }

        public string Firstname
        {
            get { return firstname; }
            set { firstname = value; }
        }

        public string Lastname
        {
            get { return lastname; }
            set { lastname = value; }
        }
        public void OnDeserialization(object sender)
        {
            ordercounter = new int[10];

            for (int i = 1; i <= 10; i++)
            {
                ordercounter[i - 1] = i;
            }
        }
    }
}
