CSharp examples for System:Array Element
Fill the array with the specified value.
// Licensed under the Apache License, Version 2.0 (the "License"); using System.Collections.Generic; using System;/* w w w . j ava2s .c o m*/ public class Main{ /// <summary> /// Fill the array with the specified value. /// </summary> /// <param name="array">The array.</param> /// <param name="v">The value.</param> public static void Fill(bool[] array, bool v) { for (int i = 0; i < array.Length; i++) { array[i] = v; } } /// <summary> /// Fill the array with the specified value. /// </summary> /// <param name="target">The array to fill.</param> /// <param name="v">The value to fill.</param> public static void Fill(float[] target, int v) { for (int i = 0; i < target.Length; i++) target[i] = v; } /// <summary> /// Fill the array with the specified value. /// </summary> /// <param name="target">The array to fill.</param> /// <param name="v">The value to fill.</param> public static void Fill(double[] target, int v) { for (int i = 0; i < target.Length; i++) target[i] = v; } /// <summary> /// Fill the specified array with the specified value. /// </summary> /// <param name="p">The array to fill.</param> /// <param name="v">The value to fill.</param> internal static void Fill(double[] p, double v) { for (int i = 0; i < p.Length; i++) p[i] = v; } }