c# - How can I convert my LINQ query to use the lambda syntax and is there any advantage to doing this? -
i have simple method:
private ilist<objective> createobjectives() { var objectivenames = new[] { "objective 1", "objective 2", "objective 3", "objective 4", "objective 5", "objective 6", "objective 7", "objective 8" }; var objectives = objectivename in objectivenames select new objective { name = objectivename, description = objectivename + " description", modifieddate = datetime.now }; return objectives.tolist(); }
is convert use lambdas , there advantage in me doing this?
objectivenames.select(o => new objective { name = o, description = o + " description", modifieddate = datetime.now }).tolist();
it's hard advantange, prefer lambdas, because don't want sql-like coding in program.
Comments
Post a Comment