Hello!
I know that there is no way of making a property both static and virtual, but is there a way around it? I have a situation where I have an abstract class, and a bunch of classes that derive that class. Now, each derived class has some properties that define them, and these properties must be only type dependent and not instance dependent. To make matters worse, I initialize the derived classes using reflection (the Activator class). What I would like to be able to do is to get these properties of each class using only the type of the derived class without initializing it! Is this in any way possible?
It would look something like this:
So, writing "Derived.Proper ty" should return "true".
I know that there is no way of making a property both static and virtual, but is there a way around it? I have a situation where I have an abstract class, and a bunch of classes that derive that class. Now, each derived class has some properties that define them, and these properties must be only type dependent and not instance dependent. To make matters worse, I initialize the derived classes using reflection (the Activator class). What I would like to be able to do is to get these properties of each class using only the type of the derived class without initializing it! Is this in any way possible?
It would look something like this:
Code:
abstract public class Base
{
virtual static public bool Property { get; }
}
public class Derived : Base
{
static public bool SomeProperty { get { return true; } }
}