Can anybody post some examples on how to use the Where region?
where.vl (17.7 KB)
Here’s a basic one :
The Where
region will return all elements where the condition you patch inside the region is matched.
If you only want the first element that matches a condition, you have FirstOrDefault
, or LastOrDefault
if you want the last one that matches.
In your example GetItem
fails because the condition MyValue == 18
is never matched (since you provide only 14 items as an input), so you try to GetItem
on nothing. The difference between GetItem
and GetSlice
is that GetItem
will throw an exception if you ask it for something that does not exist, whereas GetSlice
will fallback to a default value or wrap.
Which method is preferred? Foreach seems to have better perfomance.
where.vl (19.0 KB)
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.