L
L
Ledington2021-12-26 23:12:20
C++ / C#
Ledington, 2021-12-26 23:12:20

How to return Generic?

Tell me how to return from a generic int overload method? I can not understand...

public static IEnumerable<int> SomeMethod<T>(this IEnumerable<T> list, Func<T, int> someAction, int percentline)
...
return???

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vasily Bannikov, 2021-12-26
@vabka

Judging by what parameters you have passed to the method, then you need the Select method.
What is percentline for, by the way? How is it used?

F
freeExec, 2021-12-26
@freeExec

foreach (var item in list)
{
     yield return someAction(item);
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question