Method GetDeviceFromNumber
GetDeviceFromNumber(int)
Retrieves a GpuDeviceInfo object by its deviceNumber
from the static Devices list.
public static GpuDeviceInfo GetDeviceFromNumber(int deviceNumber)
Parameters
deviceNumber
intZero-based index of the device.
Returns
- GpuDeviceInfo
The GpuDeviceInfo for the specified
deviceNumber
, ornull
if the device number is out of range or the list is not initialized.
Examples
Accessing a Device By Index
GpuDeviceInfo device = GpuDeviceInfo.GetDeviceFromNumber(0);
if (device != null)
{
Console.WriteLine($"Device 0: {device.DeviceName}");
}
else
{
Console.WriteLine("No device found at index 0.");
}