'string.Join(string, string[])' 的最佳重载方法匹配有一些无效参数 [英] The best overloaded method match for 'string.Join(string, string[])' has some invalid arguments

查看:30
本文介绍了'string.Join(string, string[])' 的最佳重载方法匹配有一些无效参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想提取两个标签之间的文本.txtReadfile"包含许多标签.我想在每次出现标记时提取所有文本.

I want to extract come text between two tags. The "txtReadfile" contains many tags. I want to extract all the text in each occurrence of the tag.

我使用了以下代码.但是当我运行它时,它给出了错误:

I used the following code. but when I ran it, it gives the error:

Error # Error1 "The best overloaded method match for 'string.Join(string, string[])' has some invalid arguments"
Error #  "Argument '2': cannot convert from 'System.Collections.Generic.List<string>' to 'string[]' "

你能帮我调试一下吗?

List<string> destList = new List<string>();
string me = " <ts>(.*?)<t>";
string text =txtReadfile.Text;
foreach (Match match in Regex.Matches(text, me))
destList.Add(match.Groups[1].Value);
string output= string.Join(" ", destList);
MessageBox.Show(output);

推荐答案

尝试:

string output = string.Join(" ", destList.ToArray());

这篇关于'string.Join(string, string[])' 的最佳重载方法匹配有一些无效参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆