Can I declare / use some variable in LINQ?
For example, can I write following LINQ clearer?
var q = from PropertyDescriptor t in TypeDescriptor.GetPr
Yes, using the let keyword:
let
var q = from PropertyDescriptor t in TypeDescriptor.GetProperties(instance) let nameProperty = t.ComponentType.GetProperty(t.Name) where (nameProperty != null) select nameProperty;