File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed
最后大项目代码/YouZack-VNext/Zack.Commons Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change 11
11
namespace Zack . Commons ;
12
12
public static class ReflectionHelper
13
13
{
14
+ //增加一个根据产品名称获取assembly的方法GetAssembliesByProductName
15
+ public static List < Assembly > ? GetAssembliesByProductName ( string ProductName )
16
+ {
17
+ var asms = new List < Assembly > ( ) ;
18
+ var assm = AppDomain . CurrentDomain . GetAssemblies ( ) ;
19
+ foreach ( var assa in assm )
20
+ {
21
+
22
+ var asmCompanyAtt = assa . GetCustomAttribute < AssemblyProductAttribute > ( ) ;
23
+ if ( asmCompanyAtt != null )
24
+ {
25
+ if ( asmCompanyAtt . Product == ProductName ) {
26
+ asms . Add ( assa ) ;
27
+ }
28
+ }
29
+
30
+ }
31
+
32
+ return asms ;
33
+ }
14
34
//是否是微软等的官方Assembly
15
35
private static bool IsSystemAssembly ( Assembly asm )
16
36
{
@@ -202,4 +222,4 @@ public override int GetHashCode([DisallowNull] Assembly obj)
202
222
return obj . GetName ( ) . FullName . GetHashCode ( ) ;
203
223
}
204
224
}
205
- }
225
+ }
You can’t perform that action at this time.
0 commit comments