tag:blogger.com,1999:blog-8263949408347549596.post477800304434870285..comments2023-10-23T23:19:01.111+02:00Comments on Object-Oriented Software Development: C# Puzzle No.13 (advanced)Wiktor Zychlahttp://www.blogger.com/profile/04420514974154487039noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-8263949408347549596.post-19790189633381331682009-03-07T21:31:00.000+01:002009-03-07T21:31:00.000+01:00hint: the general solution I think of is provided ...hint: the general solution I think of is provided by Microsoft, although it is not a part of built-in Linq but rather it's provided as a separate download. it's not related however to the Entity Framework in any way and is fully usable in Linq to SQL.Wiktor Zychlahttps://www.blogger.com/profile/04420514974154487039noreply@blogger.comtag:blogger.com,1999:blog-8263949408347549596.post-3967102160806973602009-03-06T22:32:00.000+01:002009-03-06T22:32:00.000+01:001. Why the second clause does not produce correct ...<I>1. Why the second clause does not produce correct results, although it compiles correctly?<BR/></I><BR/><BR/>Well, from the exact definition of the OrderBy() extension we see:<BR/><BR/>public static IOrderedEnumerable<TSource&gtOrderBy&ltTSource, TKey>(this IEnumerable<TSource>source, Func&ltTSource, TKey& keySelector);<BR/><BR/>soo if I type :<BR/><BR/>order by "string"<BR/><BR/>is preety much the same as:<BR/><BR/>.OrderBy(x => "string")<BR/><BR/>Which is:<BR/><BR/>.OrderBy<MyClass,string>(x => "string")<BR/><BR/><I><BR/>2. How is it possible then to build generic linq expressions which sort objects by names of their properties.<BR/></I><BR/>Dont know yet :)Anonymousnoreply@blogger.com