cannot convert from 'string' to 'char[]' for split
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am using the following code to split a string: string sss="125asdasdlkmlkdfknkldj125kdjfngdkjfndkg125ksndkfjdks125"; List s = new List (sss.Split("125")); However, I receive a compile time error: cannot convert from 'string' to 'char[]' What is the correct way to split a string by another string? 回答1: There is no overload for String.Split which takes just a string , instead use the next closest match: List s = new List ( sss.Split(new string[] { "125" }, StringSplitOptions.None); 回答2: You can just create a char [] : List s = new List (sss