C#: Sorting with anonymous function -


Let's say I have a list of objects, and I want to sort it according to the date dated property. Why can not one use a representative? How do I sort them by date dated if not as shown below:

  Sort public stringDated (list & gt; CartItem & gt; items) {items.Sort (new function & quot; Cart item, Cart item, Bold & gt; ((itemA, Item B) = & gt; {Return Item A.Detted; Item BaidDate;});); }  

Why not use lambda expressions?

  public string sorted by date (list & gt; item); items (. (A, b) = & gt; a.DateModified.CompareTo (b.DateModified)); }  

Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -