The only way you could do this is if one type derived from another, they
both derived from the same type, or they both implemented the same
interface.
In any case, you would only be able to access the members on the type
which they shared in common. If you want to access functionality specific
to the type, then you have to cast to that type.
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
"valentin tihomirov" <V_*********@best.eewrote in message
news:OU**************@TK2MSFTNGP04.phx.gbl...
// define two types
class Type1 {}
class Type2 {}
// define a third type which variables are of type1 or type2
enumeration AlternativeType {Type1, Type2}
// assign
AlternativeType var1 = new Type1();
AlternativeType var2 = new Type2();