다음 코드를 디버깅하려고하는데 작동하지 않습니다. 나는이 그림 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) -
오류 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)
오류 3 : - 문자열 당신은 int.Parse()
보다는 명시 적 람다를 사용할 필요가
Cannot convert lambda expression to type 'string' because it is not a delegate type (CS1660)
모든 오류 메시지를 질문에 복사하십시오. – SLaks
'** m ** '이 코드에서'm'을 강조하려고 했습니까? 아니면 실제 코드입니까? – spender
은 hightlighted입니다. – jhonny625