Source/NFX/Serialization/SerializationUtils.cs
/// <summary>
/// Performs an action on each element of a possibly mutidimensional array
/// </summary>
Performs an action on each element of a possibly mutidimensional array
Performs an action on each element of a possibly mutidimensional array
public static void WalkArrayRead<T>(Array arr, Func<T> each)
        {
            var rank = arr.Rank;
            if (rank==1)
            {
                var i = arr.GetLowerBound(0);
                var top = arr.GetUpperBound(0);
                for(; i<=top; i++)
                  arr.SetValue(each(), i);
                return;
            }
            var idxs = new int[rank];
            doDimensionSetValue<T>(arr, idxs, 0, each);
        }
public static void WalkArrayRead < T > ( Array arr , Func < T > each ) { var rank = arr . Rank ; if ( rank == 1 ) { var i = arr . GetLowerBound ( 0 ) ; var top = arr . GetUpperBound ( 0 ) ; for ( ; i <= top ; i ++ ) arr . SetValue ( each ( ) , i ) ; return ; } var idxs = new int [ rank ] ; doDimensionSetValue < T > ( arr , idxs , 0 , each ) ; }
Performs an action on each element of a possibly mutidimensional array
Performs an action on each element of a possibly mutidimensional array
arr
Array
each
Func<T>