M
M
Mari322019-03-22 09:01:06
C++ / C#
Mari32, 2019-03-22 09:01:06

What is the output of a lambda expression?

static int FindZachetka(List<ExamPass> spisok, string zachetka)
        {
            spisok.FindIndex(s => s.zachetka == zachetka)
                {
 ????
                }
         
        };

I can't figure out what to write here. Otherwise, everything is underlined. Or is there some other way to do it?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
VoidVolker, 2019-03-22
@VoidVolker

The correct place for the error is something like this:
In general, it would be better to do something like this:

static ExamPass FindZachetka(List<ExamPass> spisok, string zachetka)
{
    return spisok.Find(s => s.zachetka == zachetka);
}

S
stictt, 2019-03-22
@stictt

I don’t understand why the second curly braces, the labda is looking for the occurrence of the offset in the collection, I suppose the value should be assigned, but this is not accurate :) , as far as I can tell, it returns only the index, without further processing.

E
eRKa, 2019-03-22
@kttotto

1. May underline because he wants to be assigned to a variable.
2. No usingusing System.Collections.Generic

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question