Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. LINQ
  4. Execute LINQ query on list with unknown elements type

Execute LINQ query on list with unknown elements type

Scheduled Pinned Locked Moved LINQ
linqcsharpdatabasefunctionaltutorial
1 Posts 1 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    m_n_r
    wrote on last edited by
    #1

    Hello. How is it possible to execute expression on list if it is unknown which type of elements this list contains.

    Expression ex = Expression.OrElse(exp1,exp2);

    //Expression<Func<DataSrc, bool>> lambda1 =
    //Expression.Lambda<Func<DataSrc, bool>>(ex, new ParameterExpression[] { pe });

    Expression lambda = Expression.Lambda(ex, new ParameterExpression[] { pe });

    ///How may i rewrite this two lines below if list's element type unknown

    //Func<<DataSrc, bool>> func = lambda1.Compile();

    //var r = list.Where(func);

    Could you suggest me some sources (articles, links) which explain how to build and work with dynamicaly builded LINQ expressions. Thank

    ---------- ----------

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups