SkyRez.ConsoleMenu 2.11.29.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package SkyRez.ConsoleMenu --version 2.11.29.2
NuGet\Install-Package SkyRez.ConsoleMenu -Version 2.11.29.2
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SkyRez.ConsoleMenu" Version="2.11.29.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SkyRez.ConsoleMenu --version 2.11.29.2
#r "nuget: SkyRez.ConsoleMenu, 2.11.29.2"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install SkyRez.ConsoleMenu as a Cake Addin
#addin nuget:?package=SkyRez.ConsoleMenu&version=2.11.29.2

// Install SkyRez.ConsoleMenu as a Cake Tool
#tool nuget:?package=SkyRez.ConsoleMenu&version=2.11.29.2

Добавляем все необходимые using:

global using ConsoleMenu;
global using static ConsoleMenu.Menu;

Создаём экземпляр класса Menu

public static Menu MainMenu = new("Главное меню:", "Пункт 1", "Пункт 2");

где Первый параметр - заголовок, а все последующие пункты меню.

Пример использования в коде:

public static void Main()
{
MainMenu:
    switch (MainMenu.GetIndex()) //Возвращает Index последнего выбранного пункта меню до нажатия на Enter. (Нажание на Esc закроет программу.)
    {
        case 0: F1(); Console.ReadKey(); break; //Действие при выборе первого пункта меню.
        case 1: F2(); Console.ReadKey(); break; //Действие при выборе второго пункта меню.
    }
    goto MainMenu;
}

В Menu.GetIndex() можно в качестве параметров можно указать строки, которые заменят в {0} в тексте, например при:

public static Menu MainMenu = new("{0} {1}:", "Пункт 1", "Пункт 2");

при

_ = MainMenu.GetIndex("Главное", "меню");

выведет

Главное меню:
* Пункт 1
* Пункт 2
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • 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
3.9.16.19 126 9/16/2023
3.9.10.3 142 9/9/2023
3.9.10.2 123 9/9/2023
3.1.20.11 262 1/20/2023
3.1.20.10 243 1/20/2023
3.1.13.4 252 1/20/2023
2.11.29.15 301 11/29/2022
2.11.29.2 291 11/28/2022
2.11.22.2 302 11/21/2022
2.11.22.1 303 11/21/2022
2.11.17.2 318 11/16/2022