Exemplo n.º 1
0
        /// <summary>
        ///     Iterates this array efficiently.
        /// </summary>
        /// <param name="function">The function to call for every value in this array.</param>
        public virtual void ForEach(ForIndexedFunctionHandler function)
        {
            fixed(double *src = this)
            {
                var cnt   = LinearLength;
                var props = Properties;

                for (int i = 0; i < cnt; i++)
                {
                    function(i / props, i % props, src[i]);
                }
            }
        }
Exemplo n.º 2
0
        public virtual void ForEach(int property, ForIndexedFunctionHandler function)
        {
            if (property >= Properties)
            {
                throw new ArgumentOutOfRangeException(nameof(property));
            }
            if (Properties == 1)
            {
                ForEach(function);
            }
            else
            {
                fixed(double *src = this)
                {
                    var cnt   = Count;
                    var props = Properties;

                    for (int i = property; i < cnt; i += props)
                    {
                        function(i / Properties, property, src[i]);
                    }
                }
            }
        }