Search code examples
c#.netlambdaanonymous-methods

How can I create anonymous method in a lambda expression using C# like I can in VB.NET?


In VB.NET, I can do this:

MyArray.Select(Function(a)
                   Dim x as string
                   x = a
                   Return x
               End Function)

How can I do this in c#?


Solution

  • myArray.Select(a => {
        ...
    });