The task is this: I need to get all the classes to create a hash from the System.Security.Cryptography namespace. They are all heirs to the HashAlgoritm class. I somewhere saw similar became for search of all classes-heirs of the interface through Assembly. How to provenut? Thank you in advance.

    1 answer 1

    Like that:

    Type ourtype = typeof(HashAlgorithm); // Базовый тип IEnumerable<Type> list = Assembly.GetAssembly(ourtype).GetTypes().Where(type => type.IsSubclassOf(ourtype)); // using System.Linq foreach(Type itm in list){ Console.WriteLine(itm); } 

    Get all the heirs (from the same assembly as the base type)

    • What you need! Thank you very much! - Donil