CSharp examples for Custom Type:Generics
Create instance of generic list
using System;/*from w w w . j a v a 2s . c om*/ using System.Collections.Generic; class Program { static void Main(string[] args) { List<string> games = new List<string>(); games.Add("A"); games.Add("B"); games.Add("P"); foreach (string game in games) { Console.WriteLine(game); } List<int> randomNumbers = new List<int>(); Random r = new Random(); randomNumbers.Add(r.Next(1, 10)); randomNumbers.Add(r.Next(1, 10)); randomNumbers.Add(r.Next(1, 10)); foreach (int n in randomNumbers) { Console.Write("{0} ", n); } } }