5
将MatchCollection转换为字符串数组
有比这更好的方法来将MatchCollection转换为字符串数组吗? MatchCollection mc = Regex.Matches(strText, @"\b[A-Za-z-']+\b"); string[] strArray = new string[mc.Count]; for (int i = 0; i < mc.Count;i++ ) { strArray[i] = mc[i].Groups[0].Value; } PS:mc.CopyTo(strArray,0)引发异常: 无法将源数组中的至少一个元素转换为目标数组类型。