Share via


IWMSNamedValues.Remove (C#)

banner art

Previous Next

IWMSNamedValues.Remove (C#)

The Remove method removes a name-value pair from the IWMSNamedValues collection.

Syntax

  IWMSNamedValues
  .Remove(
  object  varIndex
);

Parameters

varIndex

[in] object containing either the name, the index number, or the name-value pair.

Return Values

This method does not return a value.

If this method fails, it throws an exception.

Number Description
0x8002000B varIndex is an invalid index location.

Example Code

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

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

object                      varIndex;
object                      varValue;
string                      strName;

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

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

    // Add a new property to the collection of name-value pairs.
    strName = "System Administrator";
    varValue = "Bob Jenkins";
    NamedValue = NamedValues.Add(strName, varValue);

    // Remove the newly added property from the collection.
    varIndex = "System Administrator";
    NamedValues.Remove(varIndex);
}
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