c# - How to get the value of a property of a class in a non executing assembly through reflection - Stack Overflow
Wed Mar 16 2022 23:55:45 GMT+0000 (Coordinated Universal Time)
Saved by
@javicinhio
private static IEnumerable<Form> LoadFormsFromAssembly(string fileName)
{
Assembly asm = Assembly.LoadFrom(fileName);
foreach (Type type in asm.GetExportedTypes()) {
if (typeof(Form).IsAssignableFrom(type) &&
(type.Attributes & TypeAttributes.Abstract) != TypeAttributes.Abstract) {
Form form = (Form)Activator.CreateInstance(type);
yield return form;
}
}
}
content_copyCOPY
https://stackoverflow.com/questions/21444972/how-to-get-the-value-of-a-property-of-a-class-in-a-non-executing-assembly-throug
Comments