Class DeviceEventArgs<TDevice>
Event arguments given whenever a device is added or removed from the system, providing strongly-typed access to the device that triggered the event.
public abstract class DeviceEventArgs<TDevice> : EventArgs, IDeviceEventArgs<TDevice> where TDevice : IDevice
Type Parameters
TDevice
The type of device associated with this event, which must implement IDevice.
- Inheritance
-
objectEventArgsDeviceEventArgs<TDevice>
- Implements
-
IDeviceEventArgs<TDevice>
- Derived
Constructors
DeviceEventArgs(TDevice)
Constructs a new instance of the DeviceEventArgs<TDevice> class.
protected DeviceEventArgs(TDevice device)
Parameters
device
TDevice
Properties
Device
Gets the specific type of IDevice that originated the event. This property will always be populated, regardless of whether this is an arrival event or a removal event. If the device was removed, not all members will be available on the object. An exception will be thrown if you try to use the device in a way that requires it to be present.
public TDevice Device { get; }
Property Value
- TDevice
An instance of
TDevice
that triggered this event.
Remarks
This property provides access to the specific TDevice
instance associated with the current event.