参考如下代码实现:

private static Type GetTypeFromAnyLoadedAssembly(string typeName) {
   Type type = null;
   foreach (AssemblyPart part in Deployment.Current.Parts) {
      StreamResourceInfo resourceStream = Application.GetResourceStream(new Uri(part.Source, UriKind.Relative));
      if (resourceStream != null) {
         Assembly assembly = new AssemblyPart().Load(resourceStream.Stream);
         if (assembly != null) {
            type = Type.GetType(typeName + "," + assembly, false);
         }
      }
      if (type != null) {
         return type;
      }
   }
   return type;
}

相关文章:

  • 2021-12-31
  • 2021-12-06
  • 2022-12-23
  • 2021-06-27
  • 2022-12-23
  • 2022-12-23
  • 2022-01-14
  • 2021-08-22
猜你喜欢
  • 2021-09-12
  • 2021-08-24
  • 2022-12-23
  • 2022-12-23
  • 2021-07-27
  • 2021-11-13
  • 2021-11-08
相关资源
相似解决方案