Joining on multiple keys

suggest change
PropertyInfo[] stringProps = typeof (string).GetProperties(); // string properties
PropertyInfo[] builderProps = typeof(StringBuilder).GetProperties(); // stringbuilder properties

var query =
    from s in stringProps
    join b in builderProps
        on new { s.Name, s.PropertyType } equals new { b.Name, b.PropertyType }
    select new
    {
        s.Name,
        s.PropertyType,
        StringToken = s.MetadataToken,
        StringBuilderToken = b.MetadataToken
    };

Note that anonymous types in above join must contain same properties since objects are considered equal only if all their properties are equal. Otherwise query won’t compile.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:


LINQ Queries:
* Except
* Any
* JOINS
* Zip
* All
* Basics
* Where
* Sum
* Joining on multiple keys
* Concat
* Union

Table Of Contents
17 Regex
19 Arrays
21 Enum
22 Tuples
24 GUID
27 Looping
36 Casting
46 Methods
64 LINQ Queries
88 Events
92 Structs
104 Indexer
106 Stream
107 Timers
109 Threading
127 Caching
135 Pointers
147 C# Script