Reputation: 344
how can I add two new properties to the sealed Arc class. I want to extend the class with a double property to hold a double value and a string property to hold the name of the object. My first try was via the Tag property but this can only hold the double value OR the object name.
The problem is that I created a new user control with 43 arc objects and when the mouse entered an arc another control shows up the value and the name of the entered segment. So every arc uses the SAME MouseEntered function and I want to get the informations via the "object sender".
I hope anyone has a nice idea.
Upvotes: 2
Views: 2587
Reputation: 13970
You can't extend sealed clases.
Try creating your own class and having Arc as a class member, and expose this member functions.
Best regards.
Upvotes: 0
Reputation: 190986
You could use the composite pattern.
class SuperArc
{
Arc Arc { get; set; }
// other properties.
}
Upvotes: 5
Reputation: 116528
You can't. It's sealed. Either:
Arc
as a property.Arc.Tag
.For your particular problem, I would suggest #2 above or to store a Dictionary<Arc, blahblahblah>
or Dictionary<string, blahblahblah>
(by name) and look up the info you need. #1 is a lot of overhead wrapping all the methods and properties you need for drawing, and probably more hassle than it's worth.
Upvotes: 3