次のコードをデバッグしようとしていますが、動作していません。私はこの写真 http://i68.tinypic.com/2rqoaqc.jpgこのエラーをデバッグする方法:「ラムダ式を文字列に変換できませんか?
をアップロード
は、これは私のコードです:
using System;
using System.Text;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
class Program
{
static void Main()
{
string input = "code1,code2,#c55+35+97#g,coden,code3,code4,#c44+25+07#gcoden";
string output = Regex.Replace(
input,
"#c(.*?)#g",
m => "#c" + m.Groups[1].Value.Split('+').Sum(int.Parse) + "#");
Console.WriteLine(output);
}
}
そして、これらのエラー、私は取得しています、次のとおりです。
ERROR 1:
'int int.Parse(string)' has the wrong return type (CS0407) -
ERROR 2:
The call is ambiguous between the following methods or properties: 'System.Linq.Enumerable.Sum(System.Collections.Generic.IEnumerable, System.Func)' and 'System.Linq.Enumerable.Sum(System.Collections.Generic.IEnumerable, System.Func)' (CS0121)
ERROR 3: - 文字列あなたがint.Parse()
なく、明示的なラムダを使用する必要が
Cannot convert lambda expression to type 'string' because it is not a delegate type (CS1660)
すべてのエラーメッセージを質問にコピーしてください。 – SLaks
'** m **'はコード内で 'm'を強調表示しようとしていますか、それとも実際のコードですか? – spender
はhightlightedです – jhonny625