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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:11:52+00:00 2026-06-15T09:11:52+00:00

I was wanting to create a string of LINQ conditions and then plug it

  • 0

I was wanting to create a string of LINQ conditions and then plug it into a LINQ Extension method as in below. Is that possible?

 string x = "a.MemberName != null &&
  a.MemberName.Contains(RadGrid1.MasterTableView.GetColumn(\"MemberName"\).CurrentFilterValue)";                    
  var filtered1 =   listFromCache.Where(a => x);
  • 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-06-15T09:11:53+00:00Added an answer on June 15, 2026 at 9:11 am

    If your intention is to build a dynamic Linq query, then I suggest you use Expression Trees. You can create an Expression Tree describing the logic and then you can simply call Expression.Lambda to compile the tree to a delegate.

    Here is the reference documentation:

    http://msdn.microsoft.com/en-us/library/bb397951.aspx

    Edit:

    Some sample code follows. I don’t know what RadGrid1.MasterTableView.GetColumn(\"MemberName"\).CurrentFilterValue is, so I used “CurrentFilterValue” as a placeholder for what that statement evaluates to.

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Linq.Expressions;
    
    namespace ConsoleApplication1
    {
        public sealed class Document
        {
            public string MemberName { get; set; }
        }
    
        public static class Program
        {
            public static void Main(string[] args)
            {
                // Setup...
                var documents = new List<Document>();
    
                documents.Add(new Document { MemberName = "Test 1 + CurrentFilterValue" });
                documents.Add(new Document { MemberName = "Test 2 + CurrentFilterValue" });
                documents.Add(new Document { MemberName = "Test 3"});
    
                // Create the expression tree...
                var parameter = Expression.Parameter(typeof(Document), "document");
    
                var isNotNull = Expression.NotEqual(parameter, Expression.Constant(null));
    
                var containsIsTrue =
                    Expression.IsTrue(
                        Expression.Call(Expression.Property(parameter, "MemberName"),
                            typeof(string).GetMethod("Contains"),
                            Expression.Constant("CurrentFilterValue")));
    
                var bothAreTrue = Expression.And(isNotNull, containsIsTrue);
                var lambda = Expression.Lambda<Func<Document, bool>>(bothAreTrue, parameter).Compile();
    
                // Test...
                var results = documents.Where(d => lambda(d));
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am wanting to create a VB.Net app that checks a database and then
I have a list of string values (or tags) that I'm wanting to create
I was wanting to create a 2 dimensional string array that had dimensions string[5][*]
I'm trying to create a search method where I'm wanting to check whether the
I am wanting to progmatically create a new threads that programatically creates a browser
Is it possible to create rules in Outlook 2007 based on a regex string?
I am wanting to convert a string into 2 variables.. I have created a
I'm wanting to create a stopwatch so to speak in order to score my
I'm wanting to create a WoW cooldown effect where a player does some action
I am wanting to create a drop shadow for an object (or anything for

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.