S
Sin Jeong-hun
I would like to get a static property of classes through an interface.
But static isn't allowed in interface. The class types are
implementing an interface, and loaded from external assemblies (this
is my plug-in architecture). So, if the property is not static I
should create an instance for each class loaded, and instantiations
could be overheads. The static property is a description of the class
so it needn't be instantiated for all instances. I can get the static
property directly from the class, but then I can't make sure that the
class "implemented" that property. That's why I tried to define the
property in the interface in the first place. Then I thought of
putting them as an Attribute of the class, but again, I cannot make
sure that the class has the Attribute.
What would you think is the best way for this situation? Is there any
good way to make sure that the class has the static property ( as
interface does for non-static properties), or do I have to instantiate
them temporarily in order to use the property? Please give me an
advice, thank you.
But static isn't allowed in interface. The class types are
implementing an interface, and loaded from external assemblies (this
is my plug-in architecture). So, if the property is not static I
should create an instance for each class loaded, and instantiations
could be overheads. The static property is a description of the class
so it needn't be instantiated for all instances. I can get the static
property directly from the class, but then I can't make sure that the
class "implemented" that property. That's why I tried to define the
property in the interface in the first place. Then I thought of
putting them as an Attribute of the class, but again, I cannot make
sure that the class has the Attribute.
What would you think is the best way for this situation? Is there any
good way to make sure that the class has the static property ( as
interface does for non-static properties), or do I have to instantiate
them temporarily in order to use the property? Please give me an
advice, thank you.