CSharp examples for System.Collections.Generic:List
Generate a list with n size of T value.
using System.Linq; using System;// ww w . j a v a 2s.com using System.Collections.Generic; using System.Collections; using UnityEngine; public class Main{ /// <summary> /// Generate a list with n size of T value. /// </summary> public static List<T> GenerateListWithValues<T>(T value, int count) { count = Mathf.Max(0, count); var toReturn = new List<T>(count); for (int i = 0; i < count; i++) { toReturn.Add(value); } return toReturn; } }