jeudi 12 juillet 2018

Getting all namespaces in certain directory

I am trying to find a way to retrieve all the namespaces in our test directory. All classes in the project share a same namespace, so I need to get the class as well. The results I am looking for should look like this

Project.ClassA
Project.ClassB

Where Project is the namespace and ClassA is the class name. I tried out a function like this...

assembly = Assembly.GetAssembly(typeof(System.Int32));
var groups = assembly.GetTypes().Where(t => t.IsClass);

foreach(var group in groups)
{
   Console.WriteLine(group);
}

However this is returning a bunch of System information among other things, nothing related to what I am looking for. Am I on the right track here? Also, how can I make it look only in the test directory?





Aucun commentaire:

Enregistrer un commentaire