Skip to content

Commit 7adc53a

Browse files
Reduce nesting using inversion and continue
1 parent e220db3 commit 7adc53a

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

ProtectionScan/Features/MainFeature.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -294,11 +294,9 @@ private void WriteProtectionResultJson(string path, Dictionary<string, List<stri
294294
var modifyNode = modifyNodeList[i].Item1[modifyNodeList[i].Item2];
295295
var copyDictionary = new Dictionary<string, object>((Dictionary<string, object>)modifyNode);
296296
modifyNode = new List<object>();
297-
if (modifyNode is List<object> modifyThisNode)
298-
{
299-
modifyThisNode.Add(modifyNodeList[i].Item3);
300-
modifyThisNode.Add(copyDictionary);
301-
}
297+
if (modifyNode is not List<object> modifyThisNode) continue;
298+
modifyThisNode.Add(modifyNodeList[i].Item3);
299+
modifyThisNode.Add(copyDictionary);
302300
}
303301

304302
// Move nested dictionary into final dictionary with the base path as a key.

0 commit comments

Comments
 (0)