Last Updated: February 25, 2016
·
1.23K
· alexanderbrevig

Enabling your C# methods to be CLI callable

I made a library that makes it easy to enable your static functions to be called through CLI https://github.com/AlexanderBrevig/LazyCLI

Easily install with NuGet using Package Manager Console:

PM> Install-Package LazyCLI

Give this class:

namespace CLI
{
    public static class Hello
    {
        [LazyCLI]
        public static void World(string msg)
        {
            Console.WriteLine("Hello World: " + msg);
        }
    }
}

You can call the World method using:

LazyCLI.CLI.HandleArgs(new string[] { "CLI", "Hello", "World", "This is pretty handy" });

Will print:

Hello World: This is pretty handy