开发者

BuildManager.GetType on the Compact Framework ( resolving a class name at runtime on all appdomain )

开发者 https://www.devze.com 2023-01-06 12:56 出处:网络
Is there any way to search for a Type with only its type name in all application domain on the Compact Framework 2.0?

Is there any way to search for a Type with only its type name in all application domain on the Compact Framework 2.0? Type.GetType's behavior needs one to specify the assembly name on where to look. BuildManager.开发者_JS百科GetType does exactly that, but it isn't available for the CF. While this would be fine if I could call AppDomain.CurrentDomain.GetAssemblies() , I can't do that either on the CF.

If there is no better way to solve this, is there any way to intercept the assembly loading process by the main exe, so I could maintain a list of the current assemblies loaded, even those that are directly referenced by my application?

Thanks! Cauê


For me, what solved the problem was invoking Assembly.GetCallingAssembly().GetType(s) and Assembly.GetEntryAssembly().GetType(s) .

It really isn't a 1:1 substitute, and in more complex cases this will fail, but it really did the job if I wanted to put in separate assemblies the GetType() logic and the calling assembly's type. I am still looking for a way to iterate over all assemblies on an appdomain on the Compact Framework, though.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号