#do i loop through each of the

1 messages · Page 1 of 1 (latest)

clear barn
#

you have a few options
you can check if any of the queued actions already present in the list have their data set a specific way

patent snow
#

the second method looks complicated, i think ill do the first

clear barn
#

myList.Any(x => x.isAvailable) for example

#

will return true if any items in the list are available

patent snow
#

im completely clueless w/ LinQ

#

so ill just go with the first one

clear barn
#

well that is an easy starting point

patent snow
#

what does .Any do?

#

and what does x => x.isAvailable mean?

clear barn
#

x represents one item in the list

#

Any will return true or false based on the condition

#

are any available? return true

#

are none available? return false

patent snow
#

does => check each index in the list for x.isAvailable?

clear barn
#

think of the => like the contents of a standard loop

patent snow
#

so its just a shortened for loop?

clear barn
#

yup

patent snow
#

oh wow

clear barn
#

with some nice syntactical sugar around it

patent snow
#

this'll take some getting used to, but wow this looks handy

#

thank you so much

clear barn
#
        var isAvailable = false;

        foreach (var item in list)
        {
            if (item.isAvailable)
                isAvailable = true;
        }```