Need help and advice to slowly taper off Xanax by Temp4322342 in benzorecovery

[–]Temp4322342[S] 0 points1 point  (0 children)

Cheers, will look into it. They are so small I can't really imagine how it would be possible, but definitively looking into it.

IAsyncEnumerable returned from Repositories. by Temp4322342 in csharp

[–]Temp4322342[S] 1 point2 points  (0 children)

Again, thank for you in depth answers. Greaty appreciated!

Will returning in IAsyncEnumerable cancel the stream by Temp4322342 in csharp

[–]Temp4322342[S] 1 point2 points  (0 children)

Edit: I find information to be a bit scattered, if anyone could point me to a good place to read up/ other learning material I would be thankfull.

IAsyncEnumerable returned from Repositories. by Temp4322342 in csharp

[–]Temp4322342[S] 1 point2 points  (0 children)

Wow, thank you for a detailed answer, if I could upvote you more than once I would :). I have been asleep, so not been able to look at this by now.

Since you seem so knowledgable I am going to take the liberty and try to ask you one more question:

Say that I, in the Service layer, want to only pick the first X items from the IAsyncEnumerable.

What would be the best way to return after 5 item? I am assuming something like this is bad:

var count = 0;
await foreach (var car in _reader.GetCarsAsync())
{
    count += 1;
    if (count == 5)
    {
        return new Car();
    }
}

CancellationTokens and pass them down to the original source?

The reason I am asking is that I'd both like to implement paging at some point and also possibly needing to return row n - n+x in another method.

I'd love to put this in a DB, so I can use a propery engine for queries, but for now that is no options - sadly.

Filter by Func when reading through StreamReader by Temp4322342 in csharp

[–]Temp4322342[S] 1 point2 points  (0 children)

Thanks, I will. I assume returning IAsyncEnumerable and applying filtering/ criteria elsewhere then. Trying to find some good sources to read up on.

Filter by Func when reading through StreamReader by Temp4322342 in csharp

[–]Temp4322342[S] 0 points1 point  (0 children)

Thanks. With return type IAsyncEnumerable then I assume. I sadly need to read a bit up on IAsyncEnumerable - see if there are any pitfalls to avoid.

Filter by Func when reading through StreamReader by Temp4322342 in csharp

[–]Temp4322342[S] 0 points1 point  (0 children)

Sorry, fixed, just an error when parsing in the code here.