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 672891
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T00:32:05+00:00 2026-05-14T00:32:05+00:00

ParameterExpression parameter = Expression.Parameter(typeof(Product), x); MemberExpression Left = Expression.MakeMemberAccess(parameter, typeof(Product).GetProperty(Name)); ConstantExpression Right = Expression.Constant(value,

  • 0
 ParameterExpression parameter = Expression.Parameter(typeof(Product), "x");
        MemberExpression Left = Expression.MakeMemberAccess(parameter, typeof(Product).GetProperty("Name"));
        ConstantExpression Right = Expression.Constant(value, typeof(String));
        BinaryExpression expression = Expression.Equal(Left, Right);
        LambdaExpression lambada = Expression.Lambda<Func<Product, bool>>(expression, parameter);

Now how do I add this lambada to an instance of an IQuerybale, lets say _query

_query.Where(lambada.Compile());?

  • 1 1 Answer
  • 1 View
  • 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-14T00:32:06+00:00Added an answer on May 14, 2026 at 12:32 am

    I think you just need to change the type of lambda

    ParameterExpression parameter = Expression.Parameter(typeof(Product), "x");
    MemberExpression Left = Expression.MakeMemberAccess(parameter, typeof(Product).GetProperty("Name"));
    ConstantExpression Right = Expression.Constant(value, typeof(String));
    BinaryExpression expression = Expression.Equal(Left, Right);
    Expression< Func< Product, bool > > lambda = Expression.Lambda<Func<Product, bool>>(expression, parameter);
    

    Now it is an Expression<Func<Product, bool>> and IQueryable.Where takes that as an argument. Expression.Lambda<TDelegate> returns a TDelegate that is also a LambdaExpression which is why Expression.Lambda line compiles in your case and in my case, but IQueryable.Where wants to see it as an Expression<Func<Product, bool>>.

    Something like:

    List< Product > products = new List< Product >
    {
        new Product { Name = "bar" }, 
        new Product { Name = "foo" }
    };
    IQueryable< Product > queryable = products.AsQueryable().Where( lambda );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 492k
  • Answers 492k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer First, ask yourself "Why are unit tests hard to write… May 16, 2026 at 10:21 am
  • Editorial Team
    Editorial Team added an answer Try a relative layout, and instead of gravity, try android:layout_alignParentLeft=true,… May 16, 2026 at 10:21 am
  • Editorial Team
    Editorial Team added an answer The .edmx file that is your Entity Framework model is… May 16, 2026 at 10:21 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

This is the code I need to alter: var xParam = Expression.Parameter(typeof(E), typeof(E).Name); MemberExpression
When creating a lambda expression by hand I get a 'Parameter not in scope'
Given: FieldInfo field = <some valid string field on type T>; ParameterExpression targetExp =
I have a tree expression that looks like this: .Block( System.Object $instance, MyType2 $result)
I want to build a Lambda Expression using Linq Expressions that is able to
Given an expression that points to a property in an object graph, I want
I am trying to produce a simple scripting system that will be used to
I'm using the Entity Framework and I developed this extension method: public static IQueryable<TResult>
There was a library of dynamic LINQ extensions methods released as a sample with
This may be familiar to some. I have a wrapper class Ex that wraps

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.