The following code is in Haskell. How would I write similar function in C#?
squareArea xs = [pi * r^2 | r <- xs]
Just to clarify... above code is a function, that takes as input a list containing radius of circles. The expression calculates area of each of the circle in the input list.
I know that in C#, I can achieve same result, by looping thru a list and calculate area of each circle in the list and return a list containing area of circles. My question is... Can the above code be written in similar fashion in C#, perhaps using lambda expressions or LINQ?