Share via


IWMSCacheItems Object (C#)

banner art

Previous Next

IWMSCacheItems Object (C#)

The IWMSCacheItems object contains a collection of IWMSCacheItem objects that can be used to retrieve information about cached content.

The IWMSCacheItems collection exposes the following methods.

Method Description
Delete Removes an IWMSCacheItem object from the IWMSCacheItems collection.
DeleteAll Removes all IWMSCacheItem objects from the IWMSCacheItems collection.
Count Retrieves the number of IWMSCacheItem objects contained in the IWMSCacheItems collection.
length Retrieves the number of IWMSCacheItem objects contained in the IWMSCacheItems collection. This method is provided for JScript compatibility.

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 IWMSCacheItems object.

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

// Declare variables.
WMSServer                   Server;
IWMSCacheItems              CacheItems;
IWMSCacheProxyPlugin        CacheProxyPlugin;
IWMSPlugins                 Plugins;

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

    // Retrieve the IWMSPlugins object
    // containing cache proxy plug-ins.
    Plugins = Server.CacheProxy;

    // Retrieve the IWMSCacheProxyPlugin object.
    CacheProxyPlugin = (IWMSCacheProxyPlugin)Plugins[0];

    // Retrieve the IWMSCacheItems object.
    CacheItems = CacheProxyPlugin.CacheItems;
}
catch (COMException comExc) {
    // TODO: Handle COM exceptions.
}
catch (Exception e) {
    // TODO: Handle exceptions.
}

See Also

Previous Next