So I'm trying to sort a list of my objects using lambda like so:
List<DirectoryObjects> sort = dirObjList.OrderBy(ms => ms.name);
Visual Studio though says that is wrong and it says this is correct:
List<DirectoryObjects> sort = (List<DirectoryObjects>)dirObjList.OrderBy(ms => ms.name);
I've been exposed to lambda before but I've never really understood it. My way of doing it seems correct to me because I'm under the impression lambda is just sorting my list for me but still retaining it's type. Is it wrong to think that? The second instance looks...redundant to me. Why would I need to cast a sorted List when it already is that? Or should I think of lambdas as something that converts Enum's to a different type?