C# 控制台应用程序错误如下:索引(基于零)必须大于或等于零且小于参数列表的大小
我将上述内容存储为字符串,并将其传递给processstart(appName,format)。 功能如下。 我在传递参数时遇到了提到的错误C# 控制台应用程序错误如下:索引(基于零)必须大于或等于零且小于参数列表的大小,c#,C#,我将上述内容存储为字符串,并将其传递给processstart(appName,format)。 功能如下。 我在传递参数时遇到了提到的错误 string format="@\"\"\"{0}\"\" \"\"{1}\"\" \"\"{2}\"\"\",Id, ProjectId, refresh"; 您的格式字符串看起来像带参数的聚合字符串 将字符串格式更改为: public void ProcessStart(string AppName, string format) {
string format="@\"\"\"{0}\"\" \"\"{1}\"\" \"\"{2}\"\"\",Id, ProjectId, refresh";
您的
格式字符串
看起来像带参数的聚合字符串
将字符串
格式更改为:
public void ProcessStart(string AppName, string format)
{
try
{
ProcessStartInfo StartInfo = new ProcessStartInfo(System.Configuration.ConfigurationManager.AppSettings[AppName].ToString());
StartInfo.Arguments = string.Format(format);
StartInfo.CreateNoWindow = true;
StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
Process.Start(StartInfo);
}
catch (Exception ex)
{
throw ex;
}
}
然后
string format="@\"\"\"{0}\"\" \"\"{1}\"\" \"\"{2}\"\"\";
您的
格式字符串
看起来像带参数的聚合字符串
将字符串
格式更改为:
public void ProcessStart(string AppName, string format)
{
try
{
ProcessStartInfo StartInfo = new ProcessStartInfo(System.Configuration.ConfigurationManager.AppSettings[AppName].ToString());
StartInfo.Arguments = string.Format(format);
StartInfo.CreateNoWindow = true;
StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
Process.Start(StartInfo);
}
catch (Exception ex)
{
throw ex;
}
}
然后
string format="@\"\"\"{0}\"\" \"\"{1}\"\" \"\"{2}\"\"\";
您的
格式字符串
看起来像带参数的聚合字符串
将字符串
格式更改为:
public void ProcessStart(string AppName, string format)
{
try
{
ProcessStartInfo StartInfo = new ProcessStartInfo(System.Configuration.ConfigurationManager.AppSettings[AppName].ToString());
StartInfo.Arguments = string.Format(format);
StartInfo.CreateNoWindow = true;
StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
Process.Start(StartInfo);
}
catch (Exception ex)
{
throw ex;
}
}
然后
string format="@\"\"\"{0}\"\" \"\"{1}\"\" \"\"{2}\"\"\";
您的
格式字符串
看起来像带参数的聚合字符串
将字符串
格式更改为:
public void ProcessStart(string AppName, string format)
{
try
{
ProcessStartInfo StartInfo = new ProcessStartInfo(System.Configuration.ConfigurationManager.AppSettings[AppName].ToString());
StartInfo.Arguments = string.Format(format);
StartInfo.CreateNoWindow = true;
StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
Process.Start(StartInfo);
}
catch (Exception ex)
{
throw ex;
}
}
然后
string format="@\"\"\"{0}\"\" \"\"{1}\"\" \"\"{2}\"\"\";
不能在格式字符串中添加参数,这应该可以:
StartInfo.Arguments = string.Format(format, Id, ProjectId, refresh);
不能在格式字符串中添加参数,这应该可以:
StartInfo.Arguments = string.Format(format, Id, ProjectId, refresh);
不能在格式字符串中添加参数,这应该可以:
StartInfo.Arguments = string.Format(format, Id, ProjectId, refresh);
不能在格式字符串中添加参数,这应该可以:
StartInfo.Arguments = string.Format(format, Id, ProjectId, refresh);
你能显示你正在传递的参数吗?你能显示你正在传递的参数吗?你能显示你正在传递的参数吗?你能显示你正在传递的参数吗?