Typeof Operator for generic collection : Define Generic Collection « Generic « C# / CSharp Tutorial






using System;
using System.Collections.Generic;
using System.ComponentModel;

    class MainClass
    {
        static internal void DemonstrateTypeof<X>()
        {
            Console.WriteLine(typeof(X));
            Console.WriteLine(typeof(List<X>));
            Console.WriteLine(typeof(Dictionary<string, X>));
            Console.WriteLine(typeof(List<long>));
            Console.WriteLine(typeof(Dictionary<long, Guid>));
        }

        static void Main()
        {
            DemonstrateTypeof<int>();
        }
    }








18.11.Define Generic Collection
18.11.1.Create generic Bag collection class based on generic List
18.11.2.Typeof Operator for generic collection