使用反射来遍历所有引用的程序集的类型,在Silverlight? [英] Use reflection to iterate types in all referenced assemblies, in Silverlight?
问题描述
有没有equivilent这在Silverlight?
Is there an equivilent to this in silverlight?
var assemblies = AppDomain.CurrentDomain.GetAssemblies();
<一个href="http://msdn.microsoft.com/en-us/library/system.appdomain.getassemblies(v=VS.95).aspx">http://msdn.microsoft.com/en-us/library/system.appdomain.getassemblies(v=VS.95).aspx
是否有这样做的另一种方式?
Is there another way of doing this?
下面是关于如何在混合做了设计时间后......但如何在运行时?
Here's a post on how to do it for design time under blend... but how at runtime?
<一个href="http://joshsmithonwpf.word$p$pss.com/2010/01/06/the-ultimate-hack-for-silverlight-in-blend/">http://joshsmithonwpf.word$p$pss.com/2010/01/06/the-ultimate-hack-for-silverlight-in-blend/
看起来不像这是可能的:
Doesn't look like this is possible:
<一个href="http://stackoverflow.com/questions/2637549/getting-runtime-assemblies-in-silverlight-3?answertab=active#tab-top">Getting在Silverlight 3 运行时组件
<一个href="http://forums.silverlight.net/p/22050/77847.aspx">http://forums.silverlight.net/p/22050/77847.aspx
<一个href="http://forums.silverlight.net/t/22050.aspx/1?Get+a+list+of+loaded+assemblies">http://forums.silverlight.net/t/22050.aspx/1?Get+a+list+of+loaded+assemblies
推荐答案
这个问题最初提出的东西等同于 Assembly.GetExecutingAssembly()。GetAvailableTypes()
在Silverlight,所以这是我的第一个答案。的
The question originally asked for something equivalent to Assembly.GetExecutingAssembly().GetAvailableTypes()
in Silverlight, so that's my first answer.
Silverlight支持反思:
Silverlight supports reflection:
-
Assembly.GetExecutingAssembly()
支持Silverlight中,包括Windows Phone 7和Xbox 360。 -
Assembly.GetExportedTypes()
和Assembly.GetTypes()
在Silverlight的两个支撑,包括Windows 7和XBOX 360。
Assembly.GetExecutingAssembly()
is supported in Silverlight, including Windows Phone 7 and XBox 360.Assembly.GetExportedTypes()
andAssembly.GetTypes()
are both supported in Silverlight, including Windows 7 and XBox 360.
请参见文档< /一>,然后选择Silverlight的作为版本的详细信息。
See the documentation and select "Silverlight" as the version for details.
-
AppDomain.CurrentDomain
支持在Silverlight 3和4。 -
AppDomain.GetAssemblies()
支持Silverlight 4中。
AppDomain.CurrentDomain
is supported in Silverlight 3 and 4.AppDomain.GetAssemblies()
is supported in Silverlight 4.
最简单的是升级,而不必做解决方法的Silverlight 4。
The easiest is to upgrade to Silverlight 4 instead of having to do workarounds.
这篇关于使用反射来遍历所有引用的程序集的类型,在Silverlight?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!