You can get all loaded assemblies using AppDomain.CurrentDomain.GetAssemblies()
,
then get all types of these assemblies with .SelectMany(a => a.GetTypes())
then select the one type with the given name with .Single(t => t.Name == jobDesc)
.
Keep in mind that Single
throws an exception if not exactly 1 element matches the condition.
If you have multiple types with the same name (in different namespaces) you should use Where
instead.
If there may be no matching classes, use SingleOrDefault
, which returns null
if there is no matching element.
AppDomain.CurrentDomain.GetAssemblies().SelectMany(a => a.GetTypes())
.Single(t => t.Name == jobDesc)
If the desired class is in the assembly that is currently executed, you can also use
System.Reflection.Assembly.GetExecutingAssembly().GetTypes()
.Single(t => t.Name == jobDesc)