idos
Hi all,
I want to make part of my application to be created on runtime. So I figured that I can use reflection here. But know I am confuse, whether I should use Interface or Attribute to make sure the class created has certain functionality.
First option to use Interface:
In my application I specify interface
interface ICool
{
}
then the pluggable part could use the following code
class MyPluggableClass : ICool
{
}
then in my application I could specify-->
if ( typeToBeCreated is ICool == false) throw exception
else generate(typeToBeCreated)
Second option to use attribute
I specify the following attribute
class CoolAttribute : Attribute
{
}
then the pluggable part could use the following code
[Cool]
class MyPluggableClass
{
}
ten in my application I could specify -->
#get all attribute of typeToBeCreated
#if it contains CoolAttribute
then create
#else throw exception
Which way is the better way
Thank you in advace,
-idos-