EDN Admin
Well-known member
I have two lists and I want to join them and produce XML:
<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; Dim pets =
<pets>
<pet>
<name>Barley</name>
<owner>terry</owner>
</pet>
<pet>
<name>boots</name>
<owner>terry</owner>
</pet>
<pet>
<name>whiskers</name>
<owner>charlotte</owner>
</pet>
<pet>
<name>blue moon</name>
<owner>terry</owner>
</pet>
<pet>
<name>daisy</name>
<owner>daisy</owner>
</pet>
</pets>
<span style="color:Blue; Dim persons = <persons>
<person>
<first>magnus</first>
<last>hedlund</last>
</person>
<person>
<first>terry</first>
<last>adams</last>
</person>
<person>
<first>charlotte</first>
<last>weiss</last>
</person>
<person>
<first>arlene</first>
<last>huff</last>
</person>
</persons>
[/code]
Can someone help me write the VB.NET LINQ statement that will product the following results:
<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; <<span style="color:#A31515; PetOwners<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Person <span style="color:Red; FirstName<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Magnus<span style="color:Black; " <span style="color:Red; LastName<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Hedlund<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Pet<span style="color:Blue; >Daisy<span style="color:Blue; </<span style="color:#A31515; Pet<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; Person<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Person <span style="color:Red; FirstName<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Terry<span style="color:Black; " <span style="color:Red; LastName<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Adams<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Pet<span style="color:Blue; >Barley<span style="color:Blue; </<span style="color:#A31515; Pet<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Pet<span style="color:Blue; >Boots<span style="color:Blue; </<span style="color:#A31515; Pet<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Pet<span style="color:Blue; >Blue Moon<span style="color:Blue; </<span style="color:#A31515; Pet<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; Person<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Person <span style="color:Red; FirstName<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Charlotte<span style="color:Black; " <span style="color:Red; LastName<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Weiss<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Pet<span style="color:Blue; >Whiskers<span style="color:Blue; </<span style="color:#A31515; Pet<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; Person<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Person <span style="color:Red; FirstName<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Arlene<span style="color:Black; " <span style="color:Red; LastName<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Huff<span style="color:Black; " <span style="color:Blue; />
<span style="color:Blue; </<span style="color:#A31515; PetOwners<span style="color:Blue; >
[/code]
This is similar to the example at http://msdn.microsoft.com/en-us/library/bb397905(v=VS.100).aspx http://msdn.microsoft.com/en-us/library/bb397905(v=VS.100).aspx.<br/>
Ive tried to translate that C# LINQ to VB.NET LINQ and Im having trouble.
Thanks!
siegfried <hr class="sig siegfried heintze
View the full article
<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; Dim pets =
<pets>
<pet>
<name>Barley</name>
<owner>terry</owner>
</pet>
<pet>
<name>boots</name>
<owner>terry</owner>
</pet>
<pet>
<name>whiskers</name>
<owner>charlotte</owner>
</pet>
<pet>
<name>blue moon</name>
<owner>terry</owner>
</pet>
<pet>
<name>daisy</name>
<owner>daisy</owner>
</pet>
</pets>
<span style="color:Blue; Dim persons = <persons>
<person>
<first>magnus</first>
<last>hedlund</last>
</person>
<person>
<first>terry</first>
<last>adams</last>
</person>
<person>
<first>charlotte</first>
<last>weiss</last>
</person>
<person>
<first>arlene</first>
<last>huff</last>
</person>
</persons>
[/code]
Can someone help me write the VB.NET LINQ statement that will product the following results:
<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; <<span style="color:#A31515; PetOwners<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Person <span style="color:Red; FirstName<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Magnus<span style="color:Black; " <span style="color:Red; LastName<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Hedlund<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Pet<span style="color:Blue; >Daisy<span style="color:Blue; </<span style="color:#A31515; Pet<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; Person<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Person <span style="color:Red; FirstName<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Terry<span style="color:Black; " <span style="color:Red; LastName<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Adams<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Pet<span style="color:Blue; >Barley<span style="color:Blue; </<span style="color:#A31515; Pet<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Pet<span style="color:Blue; >Boots<span style="color:Blue; </<span style="color:#A31515; Pet<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Pet<span style="color:Blue; >Blue Moon<span style="color:Blue; </<span style="color:#A31515; Pet<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; Person<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Person <span style="color:Red; FirstName<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Charlotte<span style="color:Black; " <span style="color:Red; LastName<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Weiss<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Pet<span style="color:Blue; >Whiskers<span style="color:Blue; </<span style="color:#A31515; Pet<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; Person<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Person <span style="color:Red; FirstName<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Arlene<span style="color:Black; " <span style="color:Red; LastName<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Huff<span style="color:Black; " <span style="color:Blue; />
<span style="color:Blue; </<span style="color:#A31515; PetOwners<span style="color:Blue; >
[/code]
This is similar to the example at http://msdn.microsoft.com/en-us/library/bb397905(v=VS.100).aspx http://msdn.microsoft.com/en-us/library/bb397905(v=VS.100).aspx.<br/>
Ive tried to translate that C# LINQ to VB.NET LINQ and Im having trouble.
Thanks!
siegfried <hr class="sig siegfried heintze
View the full article