Unless you have to use an
Array
for some reason, you would be better using one of the generic collections.
A
List<Joystick>
, for example. You would then be able to replace:
stickOne = new Joystick(dinput, device.InstanceGuid);
with (assume you called the list
sticks
as in your array)
sticks.Add(new Joystick(dinput, device.InstanceGuid));
Or even a dictionary
Dictionary<GUID, Joystick> sticks = new Dictionary<GUID, Joystick>();
sticks.Add(device.InstanceGuid, new Joystick(dinput, device.InstanceGuid));
You would then be able to look them up by their GUID, if that is required.