我使用代码转换器从VB转到C#,我在c#中遇到错误.特别是,错误Item等等string.join(",", Flop.ToArray).错误说它不包含定义item但它在VB中有效.
VB
Dim Flop As New List(Of String)
For x As Integer = 0 To Dataset9.Tables(0).Rows.Count - 1 'ROWS
Flop.Add(Dataset9.Tables(0).Rows(x).Item("Id"))
Next
strAllRoleNames = String.Join(",", Flop.ToArray)
Run Code Online (Sandbox Code Playgroud)
C#
List<string> Flop = new List<string>();
for (int x = 0; x <= Dataset9.Tables[0].Rows.Count - 1; x++)
{
Flop.Add(Dataset9.Tables[0].Rows[x].Item["Id"]);
}
strAllRoleNames = string.Join(",", Flop.ToArray);
Run Code Online (Sandbox Code Playgroud)
试试这个:
List<string> Flop = new List<string>();
for (int x = 0; x <= Dataset9.Tables[0].Rows.Count - 1; x++)
{
Flop.Add(Dataset9.Tables[0].Rows[x]["Id"].ToString());
}
strAllRoleNames = string.Join(",", Flop.ToArray());
Run Code Online (Sandbox Code Playgroud)
他们在这里失踪了三把钥匙