B
Ben Fidge
I'm using Reflection to obtain data about a given objects public properties.
I need to perform different actions depening on whether a properties class
type is derived from one of the collection classes or not.
Take the following theoretical classes:
public class MyClass {
private int FiSimpleValue = 0;
private MyCollection FoCollectionValue = new MyCollection();
public int SimpleValue {
get {
return FiSimpleValue;
}
set {
FiSimpleValue = value;
}
}
public MyCollection CollectionValue {
get {
return FoCollectionValue;
}
}
}
public class MyCollection : ArrayList {
}
I need to be able to use reflection to read off the MyClass properties and
when I encounter the CollectionValue property, be able to determine at
runtime that it's type is derived from ArrayList. This is a simple example,
but in the real-world MyClass will have multiple properties of varying types
that are all derived from ArrayList. I need to take specific action for
these properties.
Thanks
Ben Fidge
I need to perform different actions depening on whether a properties class
type is derived from one of the collection classes or not.
Take the following theoretical classes:
public class MyClass {
private int FiSimpleValue = 0;
private MyCollection FoCollectionValue = new MyCollection();
public int SimpleValue {
get {
return FiSimpleValue;
}
set {
FiSimpleValue = value;
}
}
public MyCollection CollectionValue {
get {
return FoCollectionValue;
}
}
}
public class MyCollection : ArrayList {
}
I need to be able to use reflection to read off the MyClass properties and
when I encounter the CollectionValue property, be able to determine at
runtime that it's type is derived from ArrayList. This is a simple example,
but in the real-world MyClass will have multiple properties of varying types
that are all derived from ArrayList. I need to take specific action for
these properties.
Thanks
Ben Fidge