NConsoleMenu 0.9.0

.NET Framework 4.0
There is a newer version of this package available.
See the version list below for details.
Install-Package NConsoleMenu -Version 0.9.0
dotnet add package NConsoleMenu --version 0.9.0
<PackageReference Include="NConsoleMenu" Version="0.9.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add NConsoleMenu --version 0.9.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: NConsoleMenu, 0.9.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install NConsoleMenu as a Cake Addin
#addin nuget:?package=NConsoleMenu&version=0.9.0

// Install NConsoleMenu as a Cake Tool
#tool nuget:?package=NConsoleMenu&version=0.9.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.


Console menus are easy to build, complex menus are supported, and using them is simple and quick.

NConsoleMenu is a low-ceremony framework for building console menus in .NET. Instead of manually prompting the user for input and parsing it, you define commands in a short, structured and comprehensive way, and let the library handle the rest.

NConsoleMenu aims for low overhead - simple stuff should be simple to implement. If you don't use a feature, you don't need to know anything about it. At the same time, complex scenarios are supported. Large menus can easily be split into several classes. Self-configuration occurs entirely in the background. You do not have to worry about all the annoying details involved in larger menus, it will just work.

Similar to a command shell, NConsoleMenu is built for rapid usage. Commands can be entered abbreviated, a smart parser enables even partial matching. Typing fast and blind is supported - the program will try and prevent you from entering a wrong command by accident. And if the user of your menu got lost at any point, a powerful help feature is integrated.

NConsoleMenu uses the permissive MIT license.


A single command is comprised of a keyword (selector), an optional help text describing it, and, most importantly, its behavior. The behavior can be defined as a simple lambda.

var menu = new CMenu ();
menu.Add ("test", s => Console.WriteLine ("Hello world!"));
menu.Run ();

$ test
Hello world!

To create a command with help text, simply add it during definition. Use the integrated "help" command to view help texts.

menu.Add ("time",
	s => Console.WriteLine (DateTime.UtcNow),
	"Writes the current time");

$ time
2015.10.01 17:54:38
$ help time
Writes the current time

NConsoleMenu keeps an index of all available commands and lists them upon user request via typing "help". Moreover, it also automatically assigns abbreviations to all commands (if useful) and keeps them up-to-date when you later add new commands with similar keywords.

$ help
Available commands:
e   | exit
h   | help
q   | quit
ti  | time
te  | test
Type "help <command>" for individual command help.
$ te
Hello world!

Further reading

Common use cases

Refer to common use cases for information on:

  • Creation and use of basic commands
  • Offering help to users (it's automated!)
  • Less typing thanks to automated abbreviations
  • About case sensitivity

Big menus

Read up on building complex menus.

  • Inner commands
  • Nested menus and default commands
  • Sharing code between items
  • Short and concise initialization of menu trees


About the input queue, immediate & passive mode

  • Immediate mode: Accessing all commands in a single keystroke
  • Accessing and modifying the input queue
  • Promptless mode: Only allow scripted input
  • For conditional commands, see here


Changing, formatting, redirecting or cloning console output

  • Connecting NConsoleMenu output with your logging framework of choice.

Example project

The source code contains an example project. It offers commands, which illustrate several (more or less advanced) use cases. It may be useful to reference them in your own projects.


An overview of the benefits of NConsoleMenu.

Project history and developer information

Another (much larger) project of mine uses a somewhat complex console menu, and I finally got annoyed enough by repeated, virtually equal code fragments to refactor and extract those pieces of code into a separate project. As I figured it was complete enough to be useful to others, I called it NConsoleMenu and put it on github.

In the future, there are certainly a lot of things to improve about this library, and I would definitely not call it complete or even particularly well made. The changes and issues found on this project are mostly caused by improvements and requirement changes in said larger project. I update NConsoleMenu with the relevant changes in parallel when I find the time and will continue to do so for the foreseeable future.

I'm happy to hear if you found this useful, and am open to suggestions to improve it.

Product Versions
.NET Framework net40-client
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated 1,198 5/31/2018
0.9.0 716 3/27/2018

Initial release