D
DDE
Hi all,
I have defined a meththod supposed to do some treatment with the class it
receives as argument. This method can receive different type of classes so
it's argument is defined as an object, see sample beloz
public DoSomething(object theClass) {
}
public class Myclass1 {
int myfield1;
string myfield2;
}
public class Myclass2 {
int thefield1;
string thefield2;
datetime thedate
}
If I do DoSomething(Myclass1), I can acces MemebrInfo, FIeldInfo and so one
about theClass, but I cannot use theClass.myfield1, because although
theClass has a type Myclass1, it does not have a definition for the field
myfield1. How can I "convert" theClass to a real Myclass1 to be able to use
theClass.myfield1 ? I tried different methods, but none of the worked
Thanks
Dominique
I have defined a meththod supposed to do some treatment with the class it
receives as argument. This method can receive different type of classes so
it's argument is defined as an object, see sample beloz
public DoSomething(object theClass) {
}
public class Myclass1 {
int myfield1;
string myfield2;
}
public class Myclass2 {
int thefield1;
string thefield2;
datetime thedate
}
If I do DoSomething(Myclass1), I can acces MemebrInfo, FIeldInfo and so one
about theClass, but I cannot use theClass.myfield1, because although
theClass has a type Myclass1, it does not have a definition for the field
myfield1. How can I "convert" theClass to a real Myclass1 to be able to use
theClass.myfield1 ? I tried different methods, but none of the worked
Thanks
Dominique