Posted By

rengber on 05/09/07


Tagged

Reflection Installer PerformanceCounter


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

umang_nine


Scan Assemblies Using Reflection to Locate Performance Counter Installers


 / Published in: C#
 

  1. System.Reflection.Assembly assy = System.Reflection.Assembly.LoadFile(fileName);
  2. Type[] publicTypes = assy.GetExportedTypes();
  3. foreach (Type t in publicTypes)
  4. {
  5. if (t.BaseType.Name == "Installer")
  6. {
  7. MessageBox.Show(t.Name);
  8. Installer o = (Installer)t.Assembly.CreateInstance(t.FullName);
  9. foreach (Installer i in o.Installers)
  10. {
  11. if (i.GetType().Name == "PerformanceCounterInstaller")
  12. {
  13. MessageBox.Show("Performance Counter Installer Found in Assembly " + fileName);
  14. }
  15. }
  16. }
  17. }

Report this snippet  

You need to login to post a comment.