xsharp.eu • Method Syntax - functional programm !?
Page 1 of 1

Method Syntax - functional programm !?

Posted: Wed Oct 26, 2016 11:49 am
by Phil Hepburn
Hi Nick, (and all)

When you use Method Syntax (with Lambda Expressions) in your big app, do you think it is like Functional Programming ?

Does each successive method take as input the exact output from the previous method ?

It would seem to me that some of the formats of the 'Query Syntax' although it uses Method Syntax under the hood, it may also reorder the sugary query syntax to suit some unstated criteria.

I think the above may be more true / likely for "LINQ to SQL" and "LINQ to 'Entity'". Where the Order By clause always needs to be last in the SQL query statement, but can by other places in the LINQ query code line statement.

What do you do and what are your thoughts on this / these ideas ?

Regards,
Phil.

Method Syntax - functional programm !?

Posted: Wed Oct 26, 2016 11:56 am
by NickFriend
Hi Phil,

Not sure about how query syntax works internally, but with method syntax it's as you say, each method takes as it's input the output of the previous method (to the left) in the chain... so you start from the left and work to the right, and the last thing to occur on the right is the return value.

So you literally chain methods together to refine your data until you get to the result you want.

HTH

Nick