I have written a small API to allow users to control a power supply. The PowerController object can switch electrical ports on or off:
PowerController.SwitchOn(1)
PowerController.SwitchOff(3)
The PowerController can toggle the power on four different ports by specifying an integer between 1 and 4. The user can also read back the status of all four ports using:
PowerController.GetPortStatus()
This function returns a Boolean array with a true/false value for each of the 4 ports in it. The users of my API do not like the fact that they must specify a 1 based index to turn ports on or off, but must use a 0 based index to check the status of a given port. What would be the best way of returning the port status so that the user can use the same 1 based index number that they use when turning a port on or off?
Option Basein C# as it exists in VB. The only way is to decrement/increment the array-index appropriately by 1.