Changing property type in class that implements interface with object type property.
Posted
by used2could
on Stack Overflow
See other posts from Stack Overflow
or by used2could
Published on 2010-04-18T19:46:11Z
Indexed on
2010/04/18
19:53 UTC
Read the original article
Hit count: 329
I know the title is a bit confusing but bare with me. (I'm up for suggestions on a new title lol) I'm writing a TemplateEngine that will allow me to use my own markup in text based files. I'm wanting to add controls as plugins as the application matures. Currently i've got a structure like the following:
interface IControl
string Id
object Value
class Label : IControl
string Id
string Value
class Repeater : IControl
string Id
List<IControl> Value
Now you'll see the strange part right away in the Repeater class with the Value property. I was hoping that having the Value type as object in the interface would allow me the flexibility to expand the controls as i go along. The compiler doesn't like this and for good reason i guess.
Does anyone have any suggestions how to accomplish this?
Note: Please don't go into suggesting things like use Spark View Engine for templating. There is a reason i'm creating extra work for myself.
© Stack Overflow or respective owner