linq - Learning Haskell: list comprehensions in C# -
The following code is in Haskel, how do I write the same function in C #? class xx = [pi * r ^ 2 | R & lt; - xs] Just to clarify ... The code above is a function, which takes the form of a circle as the list of inputs. Expression calculates the area of each circle in the input list. I know that in C #, I have a question about looping through a list and calculating the area of each circle and the area with a circle area ... Is the code above C # Can be written equally, perhaps using lambda bhav or LINQ? Using: IEnumerable or IEnumerable & lt; Double & gt; SquareAiria (IEnumerable & lt; int & gt; xs) {returns xs.Select (r = & gt; Math.PI * R * R); which is very close to Haskell class erea x = map (\ r -> pi * r * r) xs