Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7586011
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T19:19:05+00:00 2026-05-30T19:19:05+00:00

Filter by criterion only changes.Where(p => Evaluate(p)).Subscribe(p => { // Do something }); But

  • 0

Filter by criterion only

changes.Where(p => Evaluate(p)).Subscribe(p => { // Do something });

But how could you make it so that you get the criterion value and n values after the criterion is fulfilled (and these n values do not have to match the evaluation criterion)?

  • e.g. i would like to subscribe to a stream that returns on Evaluate(p) and one value after that (and then starts to evaluate p again)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T19:19:07+00:00Added an answer on May 30, 2026 at 7:19 pm

    Please take a look on SkipWhile and Take extension methods of IEnumerable. You can try following code:

    changes.SkipWhile(change => Evaluate(change) == false).Take(n).Subscribe(change => { /* do something */ });
    

    Edit

    New code to take all matching items from sequence with n items’ tail (without retrieving items repeatedly)

    // Let's assume elements in the sequence are of type Change
    int i = 0;
    Func<Change, bool> evaluateWithTail = change =>
    {
        if (i <= 0 || i > n)
        {
            i = Evaluate(change) ? 1 : 0;
        }
        else
        {
            i++;
        }
    
        return i > 0;
    }
    // Please note delegate is specified as parameter directly - without lambda expression
    changes.Where(evaluateWithTail).Subscribe(change => { /* do something */ });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If you create a Filter object that contains criteria for Linq that normally goes
I'm trying to filter by a list of values using the criteria API. I
Is Berkley Packet Filter supported on Windows or is there something comparable which I
I have a filter attribute that I'd like to be applied to every action
In MS Access I am trying to filter to show only records from previous
Good day. I'm trying to filter logs with get-winevent. When I working with local
My classes look something like this (I include only the relevant properties): public class
I have a session criteria statement (Fluent NHibernate) that does not seem to filter
I have a simple app that consists of: Model Items Filter criteria applied to
In my django views i have the following def create(request): query=header.objects.filter(id=a)[0] a=query.criteria_set.all() logging.debug(a.details) I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.