Create a new instance of a specified implemented monitor class.
Object of the given monitor class or null.
This function create a new instance of the given monitor class specified as type string.
Firstly the type of the monitor class will be searched in the executing assembly but if no matching type exists there all loaded assemblies will be searched if access is granted.
Exception Type | Condition |
---|---|
ArgumentNullException | Thrown if no type was given. |
TypeLoadException | Means that the given type was not found in all loaded assemblies. |
// Try to create instance of a monitor and configure it try { IMonitor crashMonitor = Monitor.Create("uws.Monitors.CrashMonitor"); crashMonitor.Configure(xmlElement); if (crashMonitor.Start() == true) { Console.WriteLine("Monitor was started"); } else { Console.WriteLine("Could not start monitor"); } } catch (Exception ex) { Console.WriteLine("Could not create new monitor. " + ex.Message); }
Monitor Class | uws.Monitors Namespace | IMonitor