Fills the two-dimensional array with the specified value. - CSharp System

CSharp examples for System:Array Dimension

Description

Fills the two-dimensional array with the specified value.

Demo Code


using System;/*  www .ja  v  a  2  s.com*/

public class Main{
        /// <summary>
        /// Fills the two-dimensional array with the specified value.
        /// </summary>
        /// <param name="array">The two-dimensional array.</param>
        /// <param name="value">The value.</param>
        public static void Fill2D(this double[,] array, double value)
        {
            for (var i = 0; i < array.GetLength(0); i++)
            {
                for (var j = 0; j < array.GetLength(1); j++)
                {
                    array[i, j] = value;
                }
            }
        }
}

Related Tutorials