Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/csharp-4.0/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# string.join to List<;字符串>;_C#_C# 4.0_C# To Vb.net - Fatal编程技术网

C# string.join to List<;字符串>;

C# string.join to List<;字符串>;,c#,c#-4.0,c#-to-vb.net,C#,C# 4.0,C# To Vb.net,我想从以下代码返回一个列表: private List<string> tokenizer(string x) ......... .......... i has done thank you 但它不起作用。有人能帮忙吗?谢谢。我要试试这个。这就是你想要的吗 var list = from s in Regex.Split(sb.ToString(), "([ \\t{}()\n])") where s.Length > 3 &&

我想从以下代码返回一个列表:

private List<string> tokenizer(string x)
.........
 ..........
i has done thank you

但它不起作用。有人能帮忙吗?谢谢。

我要试试这个。这就是你想要的吗

var list = from s in Regex.Split(sb.ToString(), "([ \\t{}()\n])") 
             where s.Length > 3 && !exclude.IsMatch(s) 
             select s.Replace("!‌", "@")).ToList()
然后您可以退回:

return list;
如果这不是您想要做的,请提供更多详细信息。

这是您想要的吗

return new List<String>(
    from s in Regex.Split(sb.ToString(), "([ \\t{}()\n])")
    where s.Length > 3 && !exclude.IsMatch(s)
    select s.Replace("!‌", "@"));
返回新列表(
从Regex.Split中的s(sb.ToString(),“([\\t{}()\n])”
其中s.Length>3&&!exclude.IsMatch
选择s.Replace(“!‌", "@"));

如果想要清理文本列表,不确定为什么要将字符串连接在一起。

String.Join返回一个字符串。您想做什么?如果只是想要一个列表,只需删除该字符串。Join并将.toarray替换为.ToList
String。Join
创建一个字符串。该方法的返回类型是什么?list of what?String.将字符串列表连接到单个字符串中,您不想这样做吗?“我想在将嘈杂的文本删除到列表中后返回字符串”我逐个理解这些单词。我看到您现在包含了一个方法签名,我或@BaliC的答案对您不起作用的原因是什么?没问题,很高兴我能提供帮助:)
return new List<String>(
    from s in Regex.Split(sb.ToString(), "([ \\t{}()\n])")
    where s.Length > 3 && !exclude.IsMatch(s)
    select s.Replace("!‌", "@"));