How to convert expression
v => names.Add(v); // Consider names as List<string> and v as string
into c# 2.0?
You can use an anonymous method instead:
Action<String> action = delegate (string v) { names.add(v); };
That will work if the existing lambda expression is being converted into a delegate. It won't work when the existing lambda expression is being converted into an expression tree.
(Do you really need to use C# 2 though? Eek. Don't forget that you can use C# 3 or higher but still target .NET 2, if that's the real requirement. The benefits in productivity for using C# 3 and higher really make it work upgrading your version of Visual Studio...)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With