-
-
Notifications
You must be signed in to change notification settings - Fork 38
Switch blocks #177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I am not sure that I understand what it says. Could you please give an example ? |
Didn't mean to close this. |
I understand now. Thinking.... |
Thx for reopenning this and considering it. Even better, take the string at the start of the block above and look up the command names using the menu parameter and call that comamnd. |
The latter was simple to implement: public IActionResult ActionDeviceCmdindexfrmCSVlistNoParam(DeviceInstance deviceInstance, string csv, byte index)
{
string[] cmds = csv.Split(',');
if (index >= cmds.Length)
{
return BadRequest("Index out of range");
}
byte subCmd = LookUpGenericCmd(deviceInstance.DeviceType, cmds[index]);
string result = sharedService.ActionDeviceCmdwithByteArrayParams((int)deviceInstance.DeviceType, HttpContext, Client, deviceInstance.ListLinkId, subCmd);
return Ok(result);
} Is only a few obvious lines different from switch-case would be useful in the longer term though, but I understand it could be complex. |
Comment. |
Unless there is already a way, it would be nice to have switch blocks based upon ordinals. Supposed one issue might be the number of switches.
Today I implemented the equivalent with nested if then else blocks.
Keep up the good work! 👍
The text was updated successfully, but these errors were encountered: