Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/260.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 我正在使用string.join将正在运行的.NET 4.0应用程序转换为.NET 3.5_C# - Fatal编程技术网

C# 我正在使用string.join将正在运行的.NET 4.0应用程序转换为.NET 3.5

C# 我正在使用string.join将正在运行的.NET 4.0应用程序转换为.NET 3.5,c#,C#,我正在将一个运行中的.NET4.0应用程序转换为.NET3.5。请帮帮我 代码如下: NameValueCollection qs = new NameValueCollection(); qs["aid"] = "aaa"; qs["fields"] = "1"; qs["aaa"] = "d"; tb.Text = String.Join("&", from item in qs.AllKeys select item + "=" + qs[item]); .NET 3.5不包含

我正在将一个运行中的.NET4.0应用程序转换为.NET3.5。请帮帮我 代码如下:

NameValueCollection qs = new NameValueCollection();
qs["aid"] = "aaa";
qs["fields"] = "1";
qs["aaa"] = "d";

tb.Text = String.Join("&", from item in qs.AllKeys select item + "=" + qs[item]);

.NET 3.5不包含

超载。因此,您必须使用


超载。要将
IEnumerable
转换为字符串数组,请使用.NET 3.5中的。

string.Join
不接受
IEnumerable
,但它接受
string[]
。您只需在LINQ查询中添加对
ToArray
的调用:

NameValueCollection qs = new NameValueCollection();
qs["aid"] = "aaa";
qs["fields"] = "1";
qs["aaa"] = "d";

tb.Text = String.Join("&", (from item in qs.AllKeys select item + "=" + qs[item]).ToArray());