Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / March 2008

Tip: Looking for answers? Try searching our database.

Possible to assign LINQ join results to original outer?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Lars-Erik - 27 Mar 2008 09:20 GMT
Hi!

I've been fiddling with composing objects with partial data in two
data-stores.
I'd like to join them 1-1 and put the inner objects on a corresponding
property on the outer one.
What I can't figure out is how to do this without creating new objects of
the outer type, assigning all properties of the outer anew, and the innter to
the correct property.

IE.
(outer, inner) => new OuterType { Prop1 = outer.Prop1, ..., InnerProp =
inner }

This tends to be a bit verbose. (and does a whole new lot of instancing)

What I'd like is this, which compiles, but don't work:

(outer, inner) => { outer = outer; outer.InnerProp = inner; }

Which in my head would keep the outer object as the main object in the
resulting enumerable with the inner object neatly assigned to its InnerProp
property. :)

Is it possible?

Signature

Lars-Erik

Lars-Erik - 27 Mar 2008 09:26 GMT
Never mind...
I clicked post, thought about it for five more seconds, and wham:
(outer, inner) => { outer.InnerProp = inner; return outer; }

The previous code of course did not compile without the return statement,
but give a rather confusing compile exception. ;) (Arguments cannot be
inferred from the usage)

Signature

Lars-Erik

> Hi!
>
[quoted text clipped - 21 lines]
>
> Is it possible?

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.