.Net generic methods

A quick look at generic methods and a modified example from: dotnetperls where classes are added to the the generic list type.

using System;
using System.Collections.Generic;

namespace GenericMethods
{
    public class GenericsConsole
    {
        private static List<T> GetInitializedList<T>(T value, int count)
        {
            var list = new List<T>();
            for (var i = 0; i < count; i++)
            {
                list.Add(value);
            }
            return list;
        }

        static void Main()
        {
            var bools = GetInitializedList(true, 2);
            var strings = GetInitializedList("String", 2);
            var ints = GetInitializedList(1, 2);
            var classes = GetInitializedList(new TestClass(), 2);

            foreach (var value in bools)
            {
                Console.WriteLine(value);
            }
            
            foreach (var value in strings)
            {
                Console.WriteLine(value);
            }

            foreach (var value in ints)
            {
                Console.WriteLine(value);
            }
            
            foreach (var value in classes)
            {
                Console.WriteLine(value.Message);
            }

            Console.ReadKey();
        }

        private class TestClass
        {
            public string Message { get; private set; }

            public TestClass()
            {
                Message = "Hello";
            }
        }
    }
}