Click or drag to resize

UsbDeviceGetMyString Property

Callback function used to get the string returned by ToString.

Namespace:  WinUsbNet
Assembly:  WinUsbNet (in WinUsbNet.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
public UsbDeviceGetMyStringCallback GetMyString { get; set; }

Property Value

Type: UsbDeviceGetMyStringCallback
Remarks

By default, ToString simply returns the fully qualified name of the type of UsbDevice, "WinUsbNet.UsbDevice". This default behavior can be changed by assigning a callback function to GetMyString. The string returned by the callback function will be the string returned by ToString.

The signature for the callback function is:

string MyStringCallback(UsbDevice dev)

Examples
The Tag property can be used to store the string to be returned by ToString. This can be done directly, with the Tag simply assigned the string, or indirectly, as a member of the object assigned to Tag. This example demonstrates a callback that can be used in the direct case, using an anonymous method.
// dev is an instance of UsbDevice
dev.GetMyString = delegate(UsbDevice device) { return (string)device.Tag; };
See Also