LibUsbDotNet/LibUsbDotNet/LibUsb/UsbContext.cs
/// <summary>
/// Returns a list of USB devices currently attached to the system.
/// </summary>
/// <returns>
/// A <see cref="UsbDeviceCollection"/> which contains the devices currently
/// attached to the system.</returns>
/// <remarks>
/// <para>
/// This is your entry point into finding a USB device to operate.
/// </para>
/// <para>
/// You are expected to dispose all the devices once you are done with them. Disposing the <see cref="UsbDeviceCollection"/>
/// will dispose all devices in that collection. You can <see cref="UsbDevice.Clone"/> a device to get a copy of the device
/// which you can use after you've disposed the <see cref="UsbDeviceCollection"/>.
/// </para>
/// </remarks>
Returns a list of USB devices currently attached to the system.
Returns a list of USB devices currently attached to the system .
public unsafe UsbDeviceCollection List()
        {
            IntPtr* list;
            var deviceCount = NativeMethods.GetDeviceList(this.context, &list);
            Collection<IUsbDevice> devices = new Collection<IUsbDevice>();
            for (int i = 0; i < deviceCount.ToInt32(); i++)
            {
                Device device = Device.DangerousCreate(list[i]);
                devices.Add(new UsbDevice(device));
            }
            NativeMethods.FreeDeviceList(list, unrefDevices: 0 );
            return new UsbDeviceCollection(devices);
        }
public unsafe UsbDeviceCollection List ( ) { IntPtr * list ; var deviceCount = NativeMethods . GetDeviceList ( this . context , & list ) ; Collection < IUsbDevice > devices = new Collection < IUsbDevice > ( ) ; for ( int i = 0 ; i < deviceCount . ToInt32 ( ) ; i ++ ) { Device device = Device . DangerousCreate ( list [ i ] ) ; devices . Add ( new UsbDevice ( device ) ) ; } NativeMethods . FreeDeviceList ( list , unrefDevices : 0 ) ; return new UsbDeviceCollection ( devices ) ; }
Returns a list of USB devices currently attached to the system.
Returns a list of USB devices currently attached to the system .
/* Do not unreference the devices */
A  which contains the devices currently
attached to the system.
A which contains the devices currently attached to the system .
remarks
This is your entry point into finding a USB device to operate.

You are expected to dispose all the devices once you are done with them. Disposing the
will dispose all devices in that collection. You can  a device to get a copy of the device
which you can use after you've disposed the .
This is your entry point into finding a USB device to operate . You are expected to dispose all the devices once you are done with them . Disposing the will dispose all devices in that collection . You can a device to get a copy of the device which you can use after you ' ve disposed the .