1
Reply

Strongly typed collection without generics

Ask a question
Kopano Choane

Kopano Choane

11 years ago
1.3k
1

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)