public int Count { get; }
The number of items (devices) contained in the collection.
(Read-only). Gets the total number of devices.
using Leadtools;using Leadtools.MediaStreaming;public Server _server = null;public bool _result = false;public void PrintCaptureDevicesExample(){try{string strDevices = "";// create an instance of the server object_server = new Leadtools.MediaStreaming.Server();// retrieve a copy of the Live StreamsLiveStreams Streams = _server.GetLiveStreams();// create live stream just to enumerate the devicesLiveStream stream = Streams.CreateLiveStream();// print the capture devices to a stringstrDevices += "--- Live Stream Devices---\n\n";//Get the Video DevicesDevices VideoDevices = stream.VideoDevices;strDevices += string.Format("--- Video Devices (count = {0}) ---\n\n", VideoDevices.Count.ToString());// Print Video Devicesint nIndex = 0;foreach (Device Device in VideoDevices){strDevices += string.Format("Device[{0}]: FriendlyName = \"{1}\".\n", nIndex.ToString(), Device.FriendlyName);strDevices += string.Format("Name = \"{0}\".\n", nIndex.ToString(), Device.Name);if (Device.Selected)strDevices += "Selected = \"true\" \n";elsestrDevices += "Selected = \"false\" \n";nIndex++;}//Get the Audio DevicesDevices AudioDevices = stream.AudioDevices;strDevices += string.Format("--- Audio Devices (count = {0}) ---\n\n", AudioDevices.ToString());// Print Audio DevicesnIndex = 0;foreach (Device Device in AudioDevices){strDevices += string.Format("Device[{0}]: FriendlyName = \"{1}\".\n", nIndex.ToString(), Device.FriendlyName);strDevices += string.Format("Name = \"{0}\".\n", nIndex.ToString(), Device.Name);if (Device.Selected)strDevices += "Selected = \"true\" \n";elsestrDevices += "Selected = \"false\" \n";nIndex++;}// display a message contains the Devices information stringMessageBox.Show(strDevices, "LEADTOOLS Media Streaming Examples", MessageBoxButtons.OK, MessageBoxIcon.Information);_result = true;}catch (Exception){_result = false;}}