using System;
using System.Windows.Forms;
using System.Collections.Generic;
using System.Text;

namespace SimplestGenericCS
{

    // Class declaration that specifies the parameterized type

    public class GenericHolder <TypeTheClientToldMeToHold>
    {
        // At construction time, show a dialog box 
        // Use the parameterized type we are passed to
        //  demonstrate to the user that we know what it is. 

        public GenericHolder()
        {
            MessageBox.Show("Type I hold is: " + typeof(TypeTheClientToldMeToHold).ToString());
        }

        // This member variable magically holds whatever type
        // the client has specified at instantiation time

        private TypeTheClientToldMeToHold objectThatIHold;

        // These methods magically accept and return the parameterized 
        // type the client has specified at instantiation time

        public void Add(TypeTheClientToldMeToHold obj)
        {
            objectThatIHold = obj;
        }

        public TypeTheClientToldMeToHold Fetch()
        {
            return objectThatIHold;
        }
    }

}
