string.join()的命名空间是什么?

编程入门 行业动态 更新时间:2024-10-28 01:17:46
本文介绍了string.join()的命名空间是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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()的命名空间是什么?

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

发布评论

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

>www.elefans.com

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