Programing/C#
c# reflection 을 이용해서 assembly의 type과 method의 갯수 파악하기
Ezzi
2020. 2. 11. 16:51
반응형
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
using System;
using System.Linq;
using System.Reflection;
namespace GetCountTypeMethod
{
class Program
{
static void Main(string[] args)
{
foreach(var refAssem in Assembly.GetEntryAssembly().GetReferencedAssemblies())
{
var name = Assembly.Load(new AssemblyName(refAssem.FullName));
int count = 0;
foreach(var type in name.DefinedTypes)
{
count += type.GetMethods().Count();
}
Console.WriteLine($"types:{name.DefinedTypes.Count()} methods:{count} - assembly name:{refAssem.Name}");
}
Console.ReadKey();
}
}
}
|
cs |
git hub 링크
https://github.com/Helloezzi/get_assembly_information
Helloezzi/get_assembly_information
How to get number of count types & methods in assembly - Helloezzi/get_assembly_information
github.com
#.Net #netcore #dotnetcore
반응형