E
E
embiid2022-01-23 18:16:01
C++ / C#
embiid, 2022-01-23 18:16:01

How to return the correct result?

I return empty IEnumerable values ​​every time:

private static IEnumerable<UserReportRow> CreateReportRows(UserReportItemDal[] source, IEnumerable<GetIdentityUserReportResponse> identityData)
{
    var result = new List<UserReportRow>();

    foreach (var item in source)
    {
        var identityItem = identityData.First(x => x.User == item.Id);

        new UserReportRow()
        {
            Name = item.Name,
            Surname = item.Surname,
            City = item.City,
            Nickname1 = identityItem.Nickname1,
            Nickname2 = identityItem.Nickname2,
        };
    }

    return result;
}


I don't understand why this is happening? And how to do it? Everything looks right

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Satisfied IT, 2022-01-23
@embiid

At the moment, the code from the question can be reduced to two lines:

private static IEnumerable<UserReportRow> CreateReportRows(UserReportItemDal[] source, IEnumerable<GetIdentityUserReportResponse> identityData)
{
       var result = new List<UserReportRow>();
       return result;
}

What, besides an empty value, should it return? After all, nothing is ever added to the returned variable.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question