'string.Join(string, string[])' 的最佳重载方法匹配有一些无效参数

编程入门 行业动态 更新时间:2024-10-09 05:19:36
本文介绍了'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[])' 的最佳重载方法匹配有一些无效参数

本文发布于:2023-06-03 07:24:30,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/471207.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:参数   方法   string   Join

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!