CSharp examples for System.Collections.Generic:List
Get Or Create List<T>
using System.Text; using System.Linq; using System.Collections.Generic; using System;//from ww w. j av a2 s. c o m public class Main{ public static List<T> GetOrCreate<T>(ref List<T>[] arr, uint index) { if (index >= arr.Length) { EnsureSize(ref arr, (int)(index * LoadConstant) + 1); } var list = arr[index]; if (list == null) { return arr[index] = new List<T>(); } return list; } }