Share via


IWMSNamedValues.set_Item (C#)

banner art

Previous Next

IWMSNamedValues.set_Item (C#)

The set_Item method specifies a name-value pair from the IWMSNamedValues collection.

Syntax

  IWMSNamedValue = IWMSNamedValues.set_Item(
 object  varIndex,
 object  varValue
);

Parameters

varIndex

[in] object containing either the name portion of the name-value pair or an index into the collection. The maximum size of a name is 250 characters.

varValue

[in] object containing the value portion of the name-value pair.

Remarks

If you supply a name and no matching name is found in the collection, the get_Item method creates a new IWMSNamedValue object containing the name and value you specify. If the name-value pair already exists, the value portion is updated.

Example Code

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

// Declare variables.
WMSServer                   Server;
IWMSNamedValues             NamedValues;
IWMSNamedValue              NamedValue;

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

    // Retrieve the IWMSNamedValues object
    // containing descriptive information about the server.
    NamedValues = Server.Properties;

    // Specify a new name-value pair.
    NamedValue = NamedValues.set_Item("MyValue", 13);
}
catch (COMException comExc) {
    // TODO: Handle COM exceptions.
}
catch (Exception e) {
    // TODO: Handle exceptions.
}

Requirements

Reference: Add a reference to Microsoft.WindowsMediaServices.

Namespace: Microsoft.WindowsMediaServices.Interop.

Assembly: Microsoft.WindowsMediaServices.dll.

Library: WMSServerTypeLib.dll.

Platform: Windows Server 2003 family, Windows Server 2008 family.

See Also

Previous Next