[英]how to convert from System.Collections.Generic.IEnumerable<char>' to 'char[]' in C#
//CS0266 Cannot implicitly convert type 'System.Collections.Generic.IEnumerable' to 'char[]'. //CS0266 无法将类型“System.Collections.Generic.IEnumerable”隐式转换为“char[]”。
foreach(string newstr in Reversewords)
{
var strArr = newstr.ToCharArray();
char[] chaArr= strArr.Reverse(); // error in this line
sb.Append(chaArr);
}
I think you shuold do this in other way, you can first, turn it to string.我认为您应该以其他方式执行此操作,您可以先将其转换为字符串。
Also you can find some intresting things about this here: IEnumerable<char> to string你也可以在这里找到一些有趣的东西: IEnumerable<char> to string
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.