public IObject GetObject()
        {
            IObject obj  = null;
            Int32   code = Convert.ToInt32(_data["Code"]);

            //Fetch the object information based on the supplied type and code.
            switch (_type)
            {
            case ObjectType.RegularCourse:
                //Get the object info from either a database or from a metadata dictionary
                obj = new RegularCourse()
                {
                    CourseCode = code, CourseName = "{Computer Security}", Professor = "Prof.David", Units = 3, Location = "OCNL 243"
                };
                break;

            case ObjectType.PreRequisites:
                //Get the object info from either a database or from a metadata dictionary
                obj = new PreRequisites()
                {
                    CourseCode = code, CourseName = "{Programming Foundations}", Professor = "Dr. Ben", Units = 6, Location = "OCNL 224"
                };
                break;

            default:
                obj = null;
                break;
            }

            return(obj);
        }
        static void Main(string[] args)
        {
            //This can be used as a singleton object
            ObjectFactory objectFactory      = new ObjectFactory();
            Dictionary <String, Object> data = new Dictionary <string, object>();

            data.Add("Code", 1);

            // Implemetation of methods
            RegularCourse course = objectFactory.Get(ObjectType.RegularCourse, data) as RegularCourse;
            PreRequisites prereq = objectFactory.Get(ObjectType.PreRequisites, data) as PreRequisites;

            Console.WriteLine(course.GetCourseInfo());
            Console.WriteLine(prereq.GetCourseInfo());
            Console.ReadLine();
        }