IWMSNamedValues Object (C#)

banner art

Previous Next

IWMSNamedValues Object (C#)

The IWMSNamedValues object contains a collection of name-value pairs.

The IWMSNamedValues object exposes the following properties.

Property Description
Add Adds an IWMSNamedValue object to the IWMSNamedValues collection.
Count Retrieves the number of name-value pairs contained in the IWMSNamedValues collection.
get_Item Retrieves a name-value pair from the IWMSNamedValues collection.
length Retrieves the number of name-value pairs contained in the IWMSNamedValues collection. This method is provided for JScript compatibility.
Remove Removes a name-value pair from the IWMSNamedValues collection.
set_Item Specifies a name-value pair from the IWMSNamedValues collection.

Example Code

The following example illustrates how to retrieve an IWMSNamedValues object.

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

// Declare variables.
WMSServer                   Server;
IWMSNamedValues             NamedValues;

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

    // Retrieve the IWMSNamedValues object
    // containing descriptive information about the server.
    NamedValues = Server.Properties;
}
catch (COMException comExc) {
    // TODO: Handle COM exceptions.
}
catch (Exception e) {
    // TODO: Handle exceptions.
}

System and custom plug-ins contain default name-value pairs that can be accessed by simply indexing the name of the property you want to retrieve. For a list of the default values you can access, see Registering Plug-in Properties.

The following example illustrates how to retrieve some default configuration values from the WMS Digest Authentication plug-in.

// Declare variables.
WMSServer                   Server;
IWMSNamedValues             Properties;
IWMSPlugin                  Plugin;

string                      ASPMoniker;
string                      Author;
string                      Copyright;
string                      Descr;
string                      MMCMoniker;
string                      Name;
string                      Realm;
int                         UnspptLdType;
int                         WMSSystemPlugin;

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

    // Retrieve a WMS Digest Authentication plug-in.
    Plugin = Server.Authenticators["WMS Digest Authentication"];

    // Retrieve a collection of properties for the WMS Digest
    // Authentication plug-in.
    Properties = Plugin.Properties;

    // Retrieve each configuration property specified
    // for the plug-in. The Value() property returns an
    // object type. You can unbox it using the appropriate 
    // explicit cast.
    WMSSystemPlugin = (int)Properties.get_Item("WMSSystemPlugin").Value;
    MMCMoniker = (string)Properties.get_Item("MMCMoniker").Value;
    ASPMoniker = (string)Properties.get_Item("ASPMoniker").Value;
    UnspptLdType = (int)Properties.get_Item("UnsupportedLoadTypes").Value;
    Realm = (string)Properties.get_Item("Realm").Value;
    Name = (string)Properties.get_Item("Name").Value;
    Descr = (string)Properties.get_Item("Description").Value;
    Author = (string)Properties.get_Item("Author").Value;
    Copyright = (string)Properties.get_Item("Copyright").Value;
}
catch (COMException comExc) {
    // TODO: Handle COM exceptions.
}
catch (Exception e) {
    // TODO: Handle exceptions.
}

See Also

Previous Next