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. "The name 'item' does not exist in the current context" [modified]

"The name 'item' does not exist in the current context" [modified]

Scheduled Pinned Locked Moved LINQ
questionlinqhelplearning
4 Posts 2 Posters 2 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.
  • E Offline
    E Offline
    enginco
    wrote on last edited by
    #1

    Hi everbody :doh:

    IQueryable myObjs = ....;

    var result =
    from item in myObjs.Where(SearchKeyPredicate().And(AndKeyPredicate(item)))
    select item;

    I know this code is wrong and studio doesn't build it:(of course) ERROR = "The name 'item' does not exist in the current context" I need each items to use in "AndKeyPredicate(item)" How can I take the item in this code part? Or How can I know that which item of myObjs.Where(?) is running? thanx...

    modified on Thursday, July 17, 2008 10:23 AM

    J 1 Reply Last reply
    0
    • E enginco

      Hi everbody :doh:

      IQueryable myObjs = ....;

      var result =
      from item in myObjs.Where(SearchKeyPredicate().And(AndKeyPredicate(item)))
      select item;

      I know this code is wrong and studio doesn't build it:(of course) ERROR = "The name 'item' does not exist in the current context" I need each items to use in "AndKeyPredicate(item)" How can I take the item in this code part? Or How can I know that which item of myObjs.Where(?) is running? thanx...

      modified on Thursday, July 17, 2008 10:23 AM

      J Offline
      J Offline
      Judah Gabriel Himango
      wrote on last edited by
      #2

      How about

      from item in myObjs
      where SearchKeyPredicate().And(AndKeyPredicate(item)
      select item;

      Life, family, faith: Give me a visit. From my latest post: "We are Christian, resistance is futile. Your Jewish traits will be assimilated into the Church collective." Judah Himango

      E 1 Reply Last reply
      0
      • J Judah Gabriel Himango

        How about

        from item in myObjs
        where SearchKeyPredicate().And(AndKeyPredicate(item)
        select item;

        Life, family, faith: Give me a visit. From my latest post: "We are Christian, resistance is futile. Your Jewish traits will be assimilated into the Church collective." Judah Himango

        E Offline
        E Offline
        enginco
        wrote on last edited by
        #3

        Cannot implicitly convert type 'System.Linq.Expressions.Expression<myobject,bool>>' to 'bool'

        J 1 Reply Last reply
        0
        • E enginco

          Cannot implicitly convert type 'System.Linq.Expressions.Expression<myobject,bool>>' to 'bool'

          J Offline
          J Offline
          Judah Gabriel Himango
          wrote on last edited by
          #4

          I can't determine your problem because I don't know what your code does regarding the And stuff. You'll need to post your code.

          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