C#加入多个按键
示例
PropertyInfo[] stringProps = typeof (string).GetProperties();//字符串属性
PropertyInfo[] builderProps = typeof(StringBuilder).GetProperties();//stringbuilder属性
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
};请注意,上述匿名类型join必须包含相同的属性,因为仅当对象的所有属性都相等时,它们才被视为相等。否则查询将无法编译。