获取一个类型的装配在Windows 8 [英] Getting a Type Assembly in Windows 8

查看:96
本文介绍了获取一个类型的装配在Windows 8的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在Windows 8中使用MEF。



为了建立我的 AssemblyCatalog 的容器,我需要的程序集的引用。在过去,我刚做这样的:

  VAR目录=新AssemblyCatalog(typeof运算(APP).Assembly); 



奇怪的是,大会属性不再存在在键入对象。任何人都知道一个良好的工作在吗?是否有另一种方式来获得大会?我可以用的Assembly.Load 加载它,但我需要的程序集的名称。我无法从任何类型



时使用 DirectoryCatalog 可换用的?我不喜欢这个想法,但我会做什么,我需要。


解决方案

 使用的System.Reflection; 

使用 type.GetTypeInfo()。大会来代替。


I'm trying to use MEF in Windows 8.

In order to build up my AssemblyCatalog for the container, I need a reference to the assembly. In the past, I would have just done this:

var catalog = new AssemblyCatalog(typeof(App).Assembly);

Mysteriously, the Assembly property no longer exists on the Type object. Anybody know of a good work around? Is there another way to get the assembly? I could load it using Assembly.Load, but I would need the name of the assembly. I can't get that from the type either.

Is using a DirectoryCatalog a possible alternate? I don't like the idea, but I'll do what I need to.

解决方案

using System.Reflection;

Use type.GetTypeInfo().Assembly instead.

这篇关于获取一个类型的装配在Windows 8的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆