CSharp examples for System:Array Element
Fill an array
using System.Collections; using UnityEngine; public class Main{ public static void Fill<T>(this T[,] originalArray, T with) { for(int i = 0; i < originalArray.GetLength(0); i++){ for (int j = 0; j < originalArray.GetLength(1); j++) {/*from w w w. java 2 s . c o m*/ originalArray[i, j] = with; } } } public static void Fill<T>(this T[] originalArray, T with) { for(int i = 0; i < originalArray.Length; i++){ originalArray[i] = with; } } }