austen.ConsoleHelperLibrary 1.0.15

dotnet add package austen.ConsoleHelperLibrary --version 1.0.15
                    
NuGet\Install-Package austen.ConsoleHelperLibrary -Version 1.0.15
                    
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="austen.ConsoleHelperLibrary" Version="1.0.15" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="austen.ConsoleHelperLibrary" Version="1.0.15" />
                    
Directory.Packages.props
<PackageReference Include="austen.ConsoleHelperLibrary" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add austen.ConsoleHelperLibrary --version 1.0.15
                    
#r "nuget: austen.ConsoleHelperLibrary, 1.0.15"
                    
#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.
#:package austen.ConsoleHelperLibrary@1.0.15
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=austen.ConsoleHelperLibrary&version=1.0.15
                    
Install as a Cake Addin
#tool nuget:?package=austen.ConsoleHelperLibrary&version=1.0.15
                    
Install as a Cake Tool

<h1 align="center"> ConsoleLibraryHelper </h1>

<p align="center"> <a href="https://www.nuget.org/packages/austen.ConsoleHelperLibrary/" alt=""> <img src="https://img.shields.io/nuget/v/austen.ConsoleHelperLibrary" /></a> <a href="https://www.nuget.org/packages/austen.ConsoleHelperLibrary/" alt=""> <img src="https://img.shields.io/nuget/dt/austen.ConsoleHelperLibrary" /></a> <a href="https://badgen.net/badge/icon/github?icon=github&label" alt=""> <img src="https://badgen.net/badge/icon/github?icon=github&label" /></a> <a href="https://img.shields.io/github/license/aus10code/ConsoleHelperLibrary" alt=""> <img src="https://img.shields.io/github/license/aus10code/ConsoleHelperLibrary" /></a> </p>

ConsoleLibraryHelper simplifies the capture of string, boolean, and number types from console users.

To use this library, add the "using ConsoleHelperLibrary" statement

Explanation

You can request either a string, boolean, or number type.

Each of the 3 types have unique requirements you can place on the data you will be requesting. If data returned by user is invalid, it will state the error and prompt the user to try again.

Some requirement examples include a minimum or maximum string length or only allowing positive numbers. They can be used individually or chained together in any order you may like

String

"What is your first name: ".RequestStringFromConsole().WithNoSpaces().Close();

RequestStringFromConsole

  • WithMinLengthOf(int minLength)
  • WithMaxLengthOf(int maxLength)
  • WithNoSpaces()
  • WithNoSpecialCharacters()
  • WithNoNumbers()
  • WithOnlyTheseOptions(List<string> options)

Number

"What is your age: ".RequestNumberFromConsole<int>.Close();
"How much money do you have: ".RequestNumberFromConsole<decimal>.WithOnlyPositives().Close();

RequestNumberFromConsole<T>

  • WithMinValueOf(T minimumValue)
  • WIthMaxValueOf(T maximumValue)
  • WithOnlyPositives()
  • WithOnlyNegatives()

Type T can be any of the following number types

  • System.Boolean
  • System.Byte
  • System.Char
  • System.Decimal
  • System.Double
  • System.SByte
  • System.Single
  • System.UInt16
  • System.UInt32
  • System.UInt64

Bool

"Are you over 18: ".RequestBoolFromConsole().Close();

The following rules are always true

  1. All methods extend objects of type string.
  2. All requirement methods begin with the keyword With
    1. i.e WithNoSpaces(), WithNoNumbers() etc..
  3. All request methods must end with a .Close()

How To Use

Request Number From Console That Is

  • An integer
  • A positive number
  • Greater than 5
  • Less than 50

alternate text is missing from this package README image

Request String From Console That Contains

  • No numbers
  • No special characters
  • No white spaces

alternate text is missing from this package README image

Request Boolean From Console

alternate text is missing from this package README image

Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net7.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
1.0.15 334 4/28/2023
1.0.14 282 4/28/2023
1.0.13 535 8/6/2022
1.0.12 516 8/5/2022
1.0.11 506 8/5/2022
1.0.10 553 7/13/2022
1.0.9 557 7/13/2022
1.0.8 544 7/12/2022
1.0.7 564 7/12/2022
1.0.6 544 7/8/2022
1.0.5 523 7/7/2022
1.0.4 515 7/7/2022
1.0.3 522 7/7/2022

Updated to net7.0