Is there a practical alternative to struct inheritance? (C#)

Posted by Tim Coulter on Stack Overflow See other posts from Stack Overflow or by Tim Coulter
Published on 2010-04-25T11:05:09Z Indexed on 2010/04/25 11:13 UTC
Read the original article Hit count: 332

Filed under:
|
|

I am writing code that will populate the Margin, Padding and BorderThickness properties of classes in the System.Windows.Documents namespace. Each of these properties accepts a value in the form of a System.Windows.Thickness, which is a struct.

However, I wish to associate some additional data with each of these property assignments, which may subsequently be retrieved by my code. If Thickness were a class, I would inherit from it and define properties in the subclass to store my additional data items. But since it is a struct, inheritance is not possible.

Is there any practical way to achieve this, while maintaining type-compatibility with the properties I am populating?

Thanks for your ideas,

Tim

© Stack Overflow or respective owner

Related posts about struct

Related posts about inheritance