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
        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:

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

Table Of Contents