Просто объявите это с самой переменной:
var query = from string text in collection
where text.Length > 5
select text.ToUpper();
Это будет означать:
var query = collection.Cast<string>()
.Where(text => text.Length > 5)
.Select(text => text.ToUpper());