'Using `continue` keywoard in a switch nest inside a foreach loop [closed]
I have the code below (which actually is much longer than you see!)
foreach (SensorPair sensor in _sensorPairs)
{
sensorByte = (byte) sensor.Sensor;
if (!packet.Contains(sensorByte))
continue;
index = packet.IndexOf(sensorByte);
byteCount = sensor.ByteCount;
switch (byteCount)
{
case 1:
try
{
switch(sensor.ValueType)
{
case SensorValueType.Unsigned:
val = (int)packet[index + 1];
if (val > 255)
//*** WHAT DOES THIS CONTINUE DO?
continue;
else //rise the event
OnSensorReport();
break;
Does the continuekeywoard you see cause the foreach loop to start itterating next item or it just passes to the next case statement?
If it does not do anything with the foreach loop, how can I force the code to exit the switch and starts the next itteration in the foreach loop?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
