public virtual object Clone()
        {
            //clone all function without values
            //setvalues in clones.
            var clonedStore = new MemoryFunctionStore(this);

            var clonedFunctionValues = new List <IMultiDimensionalArray>();

            foreach (IMultiDimensionalArray array in functionValues)
            {
                IMultiDimensionalArray arrayClone = array != null
                                                        ? (IMultiDimensionalArray)array.Clone()
                                                        : null;

                clonedFunctionValues.Add(arrayClone);
            }
            clonedStore.FunctionValues = clonedFunctionValues;

            return(clonedStore);
        }
        public virtual object Clone()
        {
            //clone all function without values
            //setvalues in clones.
            var clonedStore = new MemoryFunctionStore(this);

            var clonedFunctionValues = new List <IMultiDimensionalArray>();

            foreach (IMultiDimensionalArray array in FunctionValues)
            {
                IMultiDimensionalArray arrayClone = null;
                if (array != null)
                {
                    arrayClone = (IMultiDimensionalArray)array.Clone();
                    arrayClone.IsAutoSorted = array.IsAutoSorted;
                    arrayClone.DefaultValue = array.DefaultValue;
                }
                clonedFunctionValues.Add(arrayClone);
            }
            clonedStore.FunctionValues = clonedFunctionValues;

            return(clonedStore);
        }