Generally speaking, LINQ to SQL does not support sequence operators that have one or more of the following qualities:
Take a lambda with an index parameter.
Rely on the properties of sequential rows, such as TakeWhile.
Rely on an arbitrary CLR implementation, such as IComparer<T>.
Examples of Unsupported
All supported sequence operators work as expected in the common language runtime (CLR) except for Average. Average returns a value of the same type as the type being averaged, whereas in the CLR Average always returns either a Double or a Decimal. If the source argument is explicitly cast to double / decimal or the selector casts to double / decimal, the resulting SQL will also have such a conversion and the result will be as expected.