Linq alias in for each loop

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • chris.kennedy@peninsula-uk.com

    Linq alias in for each loop

    I have some linqtosql

    Dim col = (From cd In ctx.TBLContactD ata _
    Join cc In ctx.TBLCompanyC ontacts On cc.CompanyConta ctID
    Equals
    cd.CompanyConta ctID _
    Select test = cc.CompanyConta ctID).Skip(0).T ake(10)


    When I loop through the collection


    For Each colobj In col
    'I want be able to write col.test but this does work


    It's important that I can reference cc.CompanyConta ctID as an alias.
  • Patrice

    #2
    Re: Linq alias in for each loop

    Hi, I answered in the vb group.

    Please avoid multiposting (i.e. posting the same question in multiple groups
    separately). Cross post (i.e. post the same question in multiple groups at
    the same time so that this post is tracked accross groups) only when really
    needed. In this particular case, ASP.NET doesn't have anything to do in the
    problem....

    --
    Patrice

    <chris.kennedy@ peninsula-uk.coma écrit dans le message de groupe de
    discussion :
    a74bc938-72b3-4e3b-8cf1-b6bc976b4929...l egroups.com...
    I have some linqtosql
    >
    Dim col = (From cd In ctx.TBLContactD ata _
    Join cc In ctx.TBLCompanyC ontacts On cc.CompanyConta ctID
    Equals
    cd.CompanyConta ctID _
    Select test = cc.CompanyConta ctID).Skip(0).T ake(10)
    >
    >
    When I loop through the collection
    >
    >
    For Each colobj In col
    'I want be able to write col.test but this does work
    >
    >
    It's important that I can reference cc.CompanyConta ctID as an alias.

    Comment

    • Fresno Bob

      #3
      Re: Linq alias in for each loop

      Sorry about that. Could you post the answer here as well as it isn't showing
      up in the other group. Cheers.

      "Patrice" <http://www.chez.com/scribe/wrote in message
      news:ACB497B1-8417-41F4-8A5C-47F06B9DCB3C@mi crosoft.com...
      Hi, I answered in the vb group.
      >
      Please avoid multiposting (i.e. posting the same question in multiple
      groups separately). Cross post (i.e. post the same question in multiple
      groups at the same time so that this post is tracked accross groups) only
      when really needed. In this particular case, ASP.NET doesn't have anything
      to do in the problem....
      >
      --
      Patrice
      >
      <chris.kennedy@ peninsula-uk.coma écrit dans le message de groupe de
      discussion :
      a74bc938-72b3-4e3b-8cf1-b6bc976b4929...l egroups.com...
      >I have some linqtosql
      >>
      >Dim col = (From cd In ctx.TBLContactD ata _
      > Join cc In ctx.TBLCompanyC ontacts On cc.CompanyConta ctID
      >Equals
      >cd.CompanyCont actID _
      > Select test = cc.CompanyConta ctID).Skip(0).T ake(10)
      >>
      >>
      >When I loop through the collection
      >>
      >>
      >For Each colobj In col
      >'I want be able to write col.test but this does work
      >>
      >>
      >It's important that I can reference cc.CompanyConta ctID as an alias.
      >
      >

      Comment

      Working...