string.join()的命名空间是什么? [英] What is the namespace for string.join ()?

查看:100
本文介绍了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节省您的时间(和我们的时间)
< a href =http://msdn.microsoft.com/en-us/library/57a79xd0(v=vs.110).aspx> String.Join方法 [ ^ ]


< blockquote>我认为

你没有收到错误加入

你得到反向错误



那里有两种可能性:

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()的命名空间是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆