【问题标题】:Skype API System.IndexOutOfRangeException C#Skype API System.IndexOutOfRangeException C#
【发布时间】:2013-04-23 20:13:05
【问题描述】:

所以我看到了一个用 c# 编码的程序。我不断收到错误。 System.IndexOutOfRangeException 是主要的,它发生在“args [0]”。这是代码:

    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 是空的。

标签: c# arrays api cmd skype


【解决方案1】:

如果args 为空,那将失败。大概您打算通过指定用户名或类似名称来启动程序。

您可以随时检查:

if (args.Length == 0)
{
    // Show an error dialog here
    return;
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-12-19
    • 1970-01-01
    • 2017-02-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多