I'm trying to get all classes from the namespace:
var commands = Assembly.GetExecutingAssembly().GetTypes()
.Where(t => String.Equals(t.Namespace, nameSpace, StringComparison.Ordinal))
.ToList();
I have only one class in this namespace:
But, in commands variable I have 2 classes:
I don't understand why it breaks. I also solved this trouble by adding
!t.FullName!.Contains("<>")
in where
statement of commands, but I don't think that it's perfect solution.
Can somebody explain me why reflection breaks?
Aucun commentaire:
Enregistrer un commentaire