Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Dynamic Casting
Message
General information
Forum:
ASP.NET
Category:
Other
Title:
Miscellaneous
Thread ID:
00883795
Message ID:
00883847
Views:
9
Hey Rock,

I don't think you can do that. AFAIK, you can only cast to an interface and that interface must be available to both the caller and callee's AppDomain...

In the past my workaround for those kind of things has been to either implement a specific interface to cast to for any dynamically created types (I was using CodeDom for this) or alternately providing a generic interface to dynamically call methods/properties on the new types through Reflection. The latter has more overhead but the advantage is that it's truly generic and you don't need anything else on the type implementation.

The latter part is written up in my Dynamic Code execution article (about COdeDom) at:

http://www.west-wind.com/presentations/DynamicCode/DynamicCode.htm

Hope this helps,

+++ Rick ---

>Hi Every body,
>
>Do you know how to make a cast with a dynamic Type
>
>You know something like that....
>Ex:
> x = (this.GetNewType())this.GetMyNewTypeObject()
>or
> x = this.GetMyNewTypeObject() as this.GetNewType()
>
>Thank's in advance
>Rock Legendre
>Wx3data
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform