Skype API System.IndexOutOfRangeException C#
所以我看到了一个用c#编码的程序。我总是在上面出错。System.IndexOutOfRangeException是主要的异常,它发生在“args[0]”处。代码如下:Skype API System.IndexOutOfRangeException C#,c#,arrays,api,cmd,skype,C#,Arrays,Api,Cmd,Skype,所以我看到了一个用c#编码的程序。我总是在上面出错。System.IndexOutOfRangeException是主要的异常,它发生在“args[0]”处。代码如下: using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Skype4COMUserProfile { class Program
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Skype4COMUserProfile
{
class Program
{
private static SKYPE4COMLib.Skype skype = new SKYPE4COMLib.Skype();
[STAThread]
static void Main(string[] args)
{
if (!skype.Client.IsRunning)
{
Environment.Exit(1);
}
skype.Client.OpenUserInfoDialog(args[0]);
}
}
}
如果有人能告诉我如何解决这个问题,我将非常感激。提前谢谢你 如果
args
为空,则会失败。您可能打算通过指定用户名或类似的方式启动程序
您可以随时检查:
if (args.Length == 0)
{
// Show an error dialog here
return;
}
看起来args是空的。