CSTypes 1.0.6
dotnet add package CSTypes --version 1.0.6
NuGet\Install-Package CSTypes -Version 1.0.6
<PackageReference Include="CSTypes" Version="1.0.6" />
<PackageVersion Include="CSTypes" Version="1.0.6" />
<PackageReference Include="CSTypes" />
paket add CSTypes --version 1.0.6
#r "nuget: CSTypes, 1.0.6"
#:package CSTypes@1.0.6
#addin nuget:?package=CSTypes&version=1.0.6
#tool nuget:?package=CSTypes&version=1.0.6
CSTypes
C# Types Argument Parser
Description
CREATED BY: [Latency McLaughlin]
UPDATED: 10/12/2026
FRAMEWORKS: net45, net451, net452, net46, net461, net462, net47, net471, net472, net48, net481, netstandard2.0, netstandard2.1, net8.0, net9.0, net10.0, net11.0
LANGUAGE: [C#] preview
OUTPUT TYPE: Library [API]
SUPPORTS: [Visual Studio]
GFX SUBSYS: [None]
TAGS: [ArgInterpreter], [CSTypes], [C#]
STATUS:
LICENSE:
VERSION: 1.0.6
Navigation
Introduction
CSTypes is a lightweight C# utility library for text-driven games and command-style applications. It provides:
- Command parsing: split input into words, lines, or a command and its remainder with
ArgInterpreter, and peel off words withCopyFirstWordandAdvWord. - Dice and random numbers: roll dice (
Dice), generate bounded random numbers (Number), and format ordinals such as 1st, 2nd and 3rd (NumericSuffix). - Validation helpers: check for whole numbers (
IsNumber) and valid IPv4/IPv6 addresses (IsValidIP). - Security helpers: generate salt keys and SHA-256 salted hashes for storing passwords.
The library multi-targets .NET Framework 4.5 through 4.8.1, .NET Standard 2.0/2.1, and .NET 8 through .NET 11.
Usage
ArgInterpreter
Tokenizes a string into Tokens (List<string>).
| Member | Description |
|---|---|
ArgInterpreter(string str, ArgTypes type = ArgTypes.Words) |
Tokenizes str according to type. |
Tokens |
The resulting tokens. |
ToString() |
Joins the tokens with a single space. |
ArgTypes
| Value | Description |
|---|---|
Words |
Tokenize the string into words. |
Cut |
Cut after the first word of the string. |
Lines |
Tokenize the string into lines. |
Types (static)
| Method | Description |
|---|---|
string CopyFirstWord(string s) |
Returns the first word of a string. |
string AdvWord(string text, bool withPunctuation = false) |
Returns the string with its first word skipped, optionally treating punctuation as delimiters. |
void Swap<T>(ref T x, ref T y) |
Swaps two values. |
int Number(int minValue, int maxValue) |
Returns a random number in the range; reversed bounds are swapped. |
int Dice(int number, int size) |
Simulates rolling number dice with size sides. Returns 0 for non-positive arguments. |
bool IsNumber(string str) |
Checks whether a string is a whole number. |
bool IsValidIP(string addr) |
Validates IPv4 and IPv6 addresses (full and compressed). |
string NumericSuffix(int number) |
Returns the ordinal suffix of a number (st, nd, rd, th). |
byte[] GenerateSaltKey() |
Generates a random 8-byte salt key. |
byte[] GenerateSaltedHash(byte[] plainText, byte[] salt) |
Generates a SHA-256 salted hash. |
Installation
This library can be installed using NuGet found here.
License
The source code for the site is licensed under the MIT license, which you can find in the MIT-LICENSE.txt file.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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 is compatible. 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 is compatible. 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 is compatible. 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. net11.0 is compatible. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
| .NET Framework | net45 is compatible. net451 is compatible. net452 is compatible. net46 is compatible. net461 is compatible. net462 is compatible. net463 was computed. net47 is compatible. net471 is compatible. net472 is compatible. net48 is compatible. net481 is compatible. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.5
- AssemblyLoader (>= 1.2.6)
- IFluentInterface (>= 2.0.3)
- Ranges (>= 1.0.10)
-
.NETFramework 4.5.1
- AssemblyLoader (>= 1.2.6)
- IFluentInterface (>= 2.0.3)
- Ranges (>= 1.0.10)
-
.NETFramework 4.5.2
- AssemblyLoader (>= 1.2.6)
- IFluentInterface (>= 2.0.3)
- Ranges (>= 1.0.10)
-
.NETFramework 4.6
- AssemblyLoader (>= 1.2.6)
- IFluentInterface (>= 2.0.3)
- Ranges (>= 1.0.10)
-
.NETFramework 4.6.1
- AssemblyLoader (>= 1.2.6)
- IFluentInterface (>= 2.0.3)
- Ranges (>= 1.0.10)
-
.NETFramework 4.6.2
- AssemblyLoader (>= 1.2.6)
- IFluentInterface (>= 2.0.3)
- Ranges (>= 1.0.10)
-
.NETFramework 4.7
- AssemblyLoader (>= 1.2.6)
- IFluentInterface (>= 2.0.3)
- Ranges (>= 1.0.10)
-
.NETFramework 4.7.1
- AssemblyLoader (>= 1.2.6)
- IFluentInterface (>= 2.0.3)
- Ranges (>= 1.0.10)
-
.NETFramework 4.7.2
- AssemblyLoader (>= 1.2.6)
- IFluentInterface (>= 2.0.3)
- Ranges (>= 1.0.10)
-
.NETFramework 4.8
- AssemblyLoader (>= 1.2.6)
- IFluentInterface (>= 2.0.3)
- Ranges (>= 1.0.10)
-
.NETFramework 4.8.1
- AssemblyLoader (>= 1.2.6)
- IFluentInterface (>= 2.0.3)
- Ranges (>= 1.0.10)
-
.NETStandard 2.0
- AssemblyLoader (>= 1.2.6)
- IFluentInterface (>= 2.0.3)
- Ranges (>= 1.0.10)
-
.NETStandard 2.1
- AssemblyLoader (>= 1.2.6)
- IFluentInterface (>= 2.0.3)
-
net10.0
- AssemblyLoader (>= 1.2.6)
- IFluentInterface (>= 2.0.3)
-
net11.0
- AssemblyLoader (>= 1.2.6)
- IFluentInterface (>= 2.0.3)
-
net8.0
- AssemblyLoader (>= 1.2.6)
- IFluentInterface (>= 2.0.3)
-
net9.0
- AssemblyLoader (>= 1.2.6)
- IFluentInterface (>= 2.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.