I have IQueryable list of objects of type T which I want to transform into objects of type K
List tranformedList = originalList.Select(x => trans
What about
List tranformedList = originalList
.Select(x => transform(x))
.OfType()
.ToList()
Takes care of unboxing an getting rid of nulls at the same time (especially when K is a struct)
David B I dont believe you that your code .Where(y => y != null) works when K is an int! There is NO WAY you will get that code to compile if K is an int!