I have a case where my loop has to start from 1 and end at 5, in between if some condition is matched i have to stop the loop(for).
for i in range(1,5) is the syntax i want the same kind of stuff to be implemented here.
I try with the following
- While and Do while. But i can’t able to stop the loop because Break works only with For Each
Enumerable.Range(Int32, Int32) Method (System.Linq) | Microsoft Learn with dot net function i try to populate it but still i can’t able to do it.
Thanks in Advance
I want to pass the Range in For each Activity. So that each item i retrieve from it would be single values from the range i set.
This can be done via extracting value by checking row index in for each but that would not be a good idea.
And if you already know the range why not use a while loop for that using a integer counter and retrieve what you want.
Why you say it’s not working with Enumerable.Range?
Check this example, it should work fine:
Thanks @Silviu I have make importing namespace error. Your solution worked better
For future reference, the second parameter is Count, not End.