Share via


ReadOnlyDeviceInfoCollection.ContainsId Method (String)

 

Indicates whether the connection contains a device with the specified device identifier.

Namespace:   Microsoft.WindowsServerSolutions.Common.Devices
Assembly:  DevicesOM (in DevicesOM.dll)

Syntax

public bool ContainsId(
    string deviceId
)
public:
bool ContainsId(
    String^ deviceId
)
Public Function ContainsId (
    deviceId As String
) As Boolean

Parameters

  • deviceId
    Type: System.String

    The identifier of the device to be found in the connection.

Return Value

Type: System.Boolean

true if the device is found in the connection; otherwise, false.

Examples

The following code example shows how to identify whether the connection contains a device with a specified identifier.

string id = "INVALID ID";

DevicesManager dm = new DevicesManager();
dm.Connect();
ReadOnlyDeviceInfoCollection devices = dm.GetAllDevicesInfo();

Console.WriteLine("Contains ID:  {0}", devices.ContainsId(id));

// expected output
// Contains ID:  False

See Also

ReadOnlyDeviceInfoCollection Class
Microsoft.WindowsServerSolutions.Common.Devices Namespace

Return to top