Kopano Choane

Kopano Choane

  • NA
  • 8
  • 3.2k

Strongly typed collection without generics

Apr 24 2013 2:36 AM

Good Morning Sir/Madam

Let us say that I created a class…

public class Subject

    {

        private string _code;

        private string _description;

 

        public string Code

        {

           

            get { return _code; }

            set { _code = value; }

        }

 

        public string Description

        {

           

            get { return _description; }

            set { _description = value; }

        } // end property   

 

        public Subject()

        {

            //empty default

        } // end method

 

        public Subject(string Code, string Description)

        {

           

            this.Code = Code;

            this.Description = Description;

        } // end method

 

        public override string ToString()

        {

            return _code + " : " + _description;

        } // end method

    }

 

Then I want to create a strongly typed collection used to store Subject objects but then I don't want to store duplicate objects with the :

public void Add(Subject subjectObj)

Please help me out..


Answers (1)