CSharp examples for System:Array Element
Ensures that the given array has at least the given size and resizes if its too small
using System.Text; using System.Linq; using System.Collections.Generic; using System;//from ww w . j a v a2s . c om public class Main{ /// <summary> /// Ensures that the given array has at least the given size and resizes if its too small /// </summary> public static void EnsureSize<T>(ref T[] arr, int size) { if (arr.Length < size) { Array.Resize(ref arr, size); } } }