Hii, 我试图在我的控制台应用程序中使用join关键字和reverse方法来反转我的字符串。但我在这个连接方法上收到错误。我试图找出这个名称空间,如果这可以帮助我。但没什么用。请建议// 我正在尝试这样的事情
static void Main( string [] args) { string text = Hello World; text = String .Join( ,text.Split(' ')。Reverse()。ToArray()); Console.WriteLine(text); Console.ReadLine(); }解决方案
使用Google节省您的时间(和我们的时间) String.Join方法 [ ^ ]
我认为 你没有收到错误加入 你得到反向错误 那里有两种可能性: 1.您正在使用
Array.Reverse(...)方法,它没有任何参数的重载。 2.在linq中有一个
Reverse()扩展方法,你想使用它。 我猜你试图在linq中使用
Reverse()扩展方法,所以你应该添加这一行:
使用 System.Linq;以上班级。
请试试这个 使用 System.String
Hii , I am trying to reverse my string using the join keyword and reverse method in my console application . But i am getting an error on this join methods . i tried to find out the namespace for this if that could help me . but nothing work . please suggest // I am trying something like this
static void Main(string[] args) { string text = "Hello World"; text = String.Join(" ", text.Split(' ').Reverse().ToArray()); Console.WriteLine(text); Console.ReadLine(); } 解决方案 Save your time(& our time) by using Google String.Join Method[^]I think You don't get error on Join You get error on Reverse There are 2 possibilities: 1. You are using the Array.Reverse(...)method and it has no overload without any arguments. 2. There is a
Reverse()extension method in linq and you want to use it. I guess you are trying to use the
Reverse()extension method in linq, so you should add this line:
using System.Linq;above your class. [Edit - shouting removed]
pls try this using System.String更多推荐
string.join()的命名空间是什么?
发布评论