How to integrate c# help into console application

纵饮孤独 提交于 2019-12-12 04:38:03

问题


Background Information (based on my first question): i want to integrate in my "GUI.exe" (written in c#) a help function. Then when i want to start in my cmd -> "GUI.exe --h" the help function.

Tried a stackoverflow- post: I have try to use this solution: Adding "--help" parameter to C# console application.

static bool ShowHelpRequired(IEnumerable<string> args)
{
    return args.Select(s => s.ToLowerInvariant())
        .Intersect(new[] { "help", "/?", "--help", "-help", "-h" }).Any();
}

Current problem:

I don't know where I can integrate the help function. I don't know whether a particular setting in my Microsoft Visual Studio must configure.

In advance thank you for your Support.


回答1:


Call ShowHelpRequired in your main method :

    static void Main(string[] args)
    {

        if(ShowHelpRequired(args))
        {
            Console.WriteLine("Show help message here");
        }
    }


来源:https://stackoverflow.com/questions/45707531/how-to-integrate-c-sharp-help-into-console-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!