Best way to implement some type of ITaggable interface

Posted by Jack on Stack Overflow See other posts from Stack Overflow or by Jack
Published on 2010-05-21T04:33:49Z Indexed on 2010/05/21 4:40 UTC
Read the original article Hit count: 163

Filed under:
|
|

I've got a program I'm creating that reports on another certain programs backup xml files. I've gotten to the point where I need to implement some type of ITaggable interface - but am unsure how to go about it code wise.

My idea is that each item (BackupClient, BackupVersion, and BackupFile) should implement an ITaggable interface for highlighting old, out of date, or non-existent files in their HTML or Excel report. The user will be able to specify tags in the settings.

My question is this, how can a user dynamically specify a "tag" such as File Date > 3 days old? - Background Color = Red. Actually I guess my question is more, how can I, the programmer, implement this dynamically? I was thinking Expression trees, but am unsure this is the way to go as I havn't studied them much.

I know my ITaggable interface would have methods such as AddTag(T tag), RemoveTag(T tag), but what exactly specifies the criteria for the tag to be added?

I realize this may be subjective, and can be marked as wiki if need be, but I truly am stuck. Any input would be greatly helpful!

© Stack Overflow or respective owner

Related posts about c#

Related posts about winforms