IWMSDiagnosticEvents Object (C#)

banner art

Previous Next

IWMSDiagnosticEvents Object (C#)

The IWMSDiagnosticEvents object contains a collection of IWMSDiagnosticEvent objects. The collection can contain a maximum of 100 IWMSDiagnosticEvent objects. When this limit is reached, the oldest object in the collection is replaced by the newest. Each IWMSDiagnosticEvent object that describes a unique server or publishing point limit is included only once in the collection, but the time and date are updated to reflect the most recent occurrence.

The IWMSDiagnosticEvents object exposes the following properties and methods.

Property Description
Count Retrieves the number of IWMSDiagnosticEvent objects contained in the IWMSDiagnosticEvents collection.
length Retrieves the number of IWMSDiagnosticEvent objects contained in the IWMSDiagnosticEvents collection. This method is provided for JScript compatibility.
Method Description
RemoveAll Removes all IWMSDiagnosticEvent objects from the IWMSDiagnosticEvents collection.

In C#, there are two ways to access objects in a collection:

  • Access individual objects directly by using a string (where applicable)
  • Iterate through the objects by using an index

You must use array notation when retrieving objects from a collection, except when using the get_Item method.

Example Code

The following example illustrates how to retrieve an IWMSDiagnosticEvents object.

using Microsoft.WindowsMediaServices.Interop;
using System.Runtime.InteropServices;

// Declare variables.
WMSServer                   Server;
IWMSDiagnosticEvents        DiagnosticEvents;

try {
    // Create a new WMSServer object.
    Server = new WMSServerClass();

    // Retrieve the IWMSDiagnosticEvents object.
    DiagnosticEvents = Server.DiagnosticEvents;
}
catch (COMException comExc) {
    // TODO: Handle COM exceptions.
}
catch (Exception e) {
    // TODO: Handle exceptions.
}

See Also

Previous Next