Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can lambdas be used without Linq?

Tags:

c#

.net

linq

I'd rather not use Linq if I don't have to (I remove references to it when I start a new project). Lambdas look useful, though. I'm not going to get in the habit of using lambdas, however, if Linq has to tag along for the ride.

Thanks in advance

like image 948
Robert H. Avatar asked Nov 27 '22 21:11

Robert H.


1 Answers

Lambdas can be used whenever you want. They're a new language feature. Linq uses them, but you don't have to use linq.

Action blah = () => { System.Console.WriteLine("Hello World!"); }
blah(); // will write Hello World! to the console
like image 131
McKay Avatar answered Nov 29 '22 11:11

McKay