Click here to Skip to main content
14,421,614 members
Rate this:
Please Sign up or sign in to vote.
See more:
how to get the count of classes and methods contained in a DLL

I know the ildasm.exe tool will show me, but in scenarios where i need to a manual check on 2 dll having count of namespaces,classess,methods etc.

Please suggest a best approach which can give me the count ?

What I have tried:

I tried illdasm.exe tool from Microsoft, trying out there would be a away to interact via commandline and the count from it
Updated 26-Apr-18 1:57am

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

ildasm.exe allows you to display a .NET module's contents, but AFAIK there is no statistical functionality built into it.

Fortunately, you can use objects in System.Reflection Namespace[^] to build your own program for that. You can search here on CP for "Reflection" and get plenty of examples about its usage.
Girish Kalamati 2-May-18 2:06am
I wrote code for that but that fails even fails if you do not have all of the depenedent dlls in the same location.

Hint: keeping all dll in for a bigger product is not such easy

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

// Use reflection
using System.Reflection;

namespace Difference_Between_DLLs
    class Program
        static void Main(string[] args)
            int count_Entities=0;
            //Assembly assembly = Assembly.ReflectionOnlyLoadFrom(@"E:\~~~~~\your.DLL");
            Console.WriteLine("DLL Name: {0}",assembly.ManifestModule.Name);            
            Console.WriteLine("---------   Displaying the names of the Entities (Interfaces, Delegates, Classes, Enums/Properties etc.)   ------------");            
            foreach (var ti in assembly.ExportedTypes.ToArray())
                count_Entities += 1;
            Console.WriteLine("Total number of entities found : {0}", count_Entities);            
            Console.WriteLine("Press any button to close !");
Girish Kalamati 2-May-18 2:07am
Thanks @phil.o , can i achieve this via ILSPY tool ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100