Parenthesis are used if there is more than one parameter for lambda function. Not required for single-parameter lambdas.
On 5 December 2011 13:17, Peter Maddin <[email protected]> wrote: > Am learning linq.**** > > ** ** > > I noticed from the examples I using to learn, that I have this**** > > ** ** > > var products = GetProducts()**** > > .Where((prod) => prod.CategoryID == 2);**** > > ** ** > > Why is prod placed inside parenthesis?**** > > ** ** > > Sometimes it is, sometimes its not.**** > > ** ** > > var productsDictionary =**** > > products.ToDictionary(prod => prod.ProductID);**** > > ** ** > > I am finding this lack of consistency somewhat confusing.**** > > Probably the parenthesis can be eliminated, but why in the first example was > it used?**** > > Where is it necessary to use parenthesis and where is it not?**** > > The use of parenthesis was introduced without any explanation. **** > > ** ** > > Sorry for such a basic question.**** > > **** > > ** ** > > *Regards Peter Maddin* > *Applications Development Officer* > *Path**West Laboratory Medicine WA* > *Phone : +618 6396 4285 (Monday, Wednesday,Friday)* > > *Phone : +618 9346 4372 (Tuesday, Thursday)** > Mobile: 0423 540 825* > *E-Mail : [email protected]; [email protected]* > *The contents of this e-mail transmission outside of the WAGHS network > are intended solely for the named recipient's), may be confidential, and > may be privileged or otherwise protected from disclosure in the public > interest. The use, reproduction, disclosure or distribution of the contents > of this e-mail transmission by any person other than the named recipient(s) > is prohibited. If you are not a named recipient please notify the sender > immediately**.***** > > **** > > ** ** >
