Remove properties from a class in C#

I have a class and few properties assigned to it.

class MyClass
{
        [Category("Common")]
        [Description("Name")]
        [Browsable(true)]
        public string Name
        {
            get { return name;} 
            set { name = value; }
        }

        [Category("Common")]
        [Description("Contact")]
        [Browsable(true)]
        public string ContactNo
        {
            get { return number;} 
            set { number = value; }
        }
}

Here,
When I instantiate this class, I want to remove contactNo property when a certain condition is met. How can I do that?


Source: .net

Leave a Reply