This message was deleted.
# general
s
This message was deleted.
1
s
Somehow for each does not work... but a while loop with a counter works
public RecoveryServices.ProtectionContainer? GetProtectionContainer(Output<string> containerName)
{ int idx = -1; int counter = 0; while (idx == -1 && counter < this.protectionContainers.Count) { _ = Output.Tuple(this.protectionContainers[counter].Name, containerName).Apply(t => { if (t.Item1 == t.Item2) { idx = counter; return true; } else{ return false; } }); } if(idx != -1) { return this.protectionContainers[idx]; } else { return null; }
Oh well false joy... I had forgotten to increment the counter in the while loop like a newb... sorry about that. So it does not work. Anybody has an idea why idx is set from within the apply but when it is used after the while loop its still -1?