SkyRez.ConsoleMenu
2.11.22.2
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package SkyRez.ConsoleMenu --version 2.11.22.2
NuGet\Install-Package SkyRez.ConsoleMenu -Version 2.11.22.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.22.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.22.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: SkyRez.ConsoleMenu, 2.11.22.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.22.2
// Install SkyRez.ConsoleMenu as a Cake Tool
#tool nuget:?package=SkyRez.ConsoleMenu&version=2.11.22.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Добавляем все необходимые 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 | Versions 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.