Hello Everyone, I have a property that returns an interface. During debugging I can break on what was returned and while it is the interface, Visual Studio is smart enough to know the derived type that it actually is. I assume it's using reflection or something. I'm not sure. My question is, can I have that same info avaialble to me at runtime so I can create a variable of the appropriate type and cast the interface as that? Here is what I am saying...
IPreDisplay preDisplay = cb.PreDisplay;
If preDisplay is a RedPreDisplay I would like to be able to code
RedPreDisplay tmp = preDisplay as RedPreDisplay;
Or if preDisplay were a GreenPreDisplay...
GreenPreDisplay tmp = preDisplay as GreenPreDisplay;
etc... I would like to avoid a messy switch statement if possible, and If I could use generics that would be great.
If you have any advice or examples of how I can do this, please share.
Thanks for the help, ~ck in San Diego