Join (keyword)
From The Oxygene Language Wiki
This is a Language topic
Feel free to add your notes to this topic below.
The most powerful and most complex query operator is join, which allows you to combine sources from two separate sequences into one result sequence.
For example:
var greet := from cust in MyCustomers join cntry in Countries on cust.Country equals cntry.Name select cntry.Greeting+' '+cust.Name;
This query would then return a sequence of strings such as "Hello Paul", "Bonjour, Jean-Pierre", and so on.
If the join is not followed by a select, its result will return anonymous types containing both of the joined sequences, similar to having specified "select cust, cntry". join can be followed by the into keyword to give a name to the new sequence, so it can be referenced further down in the query, such as:
var l := from cust in MyCustomers join cntry in Countries on cust.Country equals cntry.Name into j where j.cust.City = 'Berlin' and j.cntry.Continent = 'Europe';
This query would a list of all Customer/Country entries where the customer lives in a city named Berlin located in Europe (it will not return customers in Berlin, Wisconsin).
See Also
Area: Oxygene Language
Compiler version: Oxygene 5
Language Glossary — Keywords — Types — FAQ — How To