xNcore 1.0.0

dotnet add package xNcore --version 1.0.0
                    
NuGet\Install-Package xNcore -Version 1.0.0
                    
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="xNcore" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="xNcore" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="xNcore" />
                    
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 xNcore --version 1.0.0
                    
#r "nuget: xNcore, 1.0.0"
                    
#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 xNcore@1.0.0
                    
#: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=xNcore&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=xNcore&version=1.0.0
                    
Install as a Cake Tool

NCore

A simple library for functional writing

Information

The library contains some basic methods and classes that make it easy to write hubrid: functionally and objectively

Usage

New collections

MutableArray

Methods

NOptional<T> Get(int index)
IEnumerator<T> GetEnumerator()
T this[int index]
MutableArray<T> Of(int count)
MutableArray<T> Of(IEnumerable<T> collecion)
MutableArray<T> Of(T[] array)
MutableArray<T> GetElements(int startIndex, int count)
MutableArray<T> Take(int take)
MutableArray<T> Skip(int skip)
NOptional<T> First()
NOptional<T> Last()

Delegates

bool TryParse<T>(string value, out T result)
bool TryParseIgnoreCase<T>(string value, bool ignoreCase, out T result)

Generator (beter random)

IGen

char NextChar();
char NextChar(char maxValue);
char NextChar(char minValue, char maxValue);
sbyte NextSByte();
sbyte NextSByte(int maxValue);
sbyte NextSByte(int minValue, int maxValue);
byte NextByte();
byte NextByte(int maxValue);
byte NextByte(int minValue, int maxValue);
short NextShort();
short NextShort(int maxValue);
short NextShort(int minValue, int maxValue);
ushort NextUShort();
ushort NextUShort(int maxValue);
ushort NextUShort(int minValue, int maxValue);
int NextInt();
int NextInt(int maxValue);
int NextInt(int minValue, int maxValue);
uint NextUInt();
uint NextUInt(uint maxValue);
uint NextUInt(uint minValue, uint maxValue);
long NextLong();
long NextLong(long maxValue);
long NextLong(long minValue, long maxValue);
ulong NextULong();
ulong NextULong(ulong maxValue);
ulong NextULong(ulong minValue, ulong maxValue);
BigInteger NextBigInteger(int BitLength = 128);
BigInteger NextBigUnsignedInteger(int BitLength = 128);
BigInteger NextBigInteger(int MinBitLength, int MaxBitLength);
BigInteger NextBigUnsignedInteger(int MinBitLength, int MaxBitLength);
float NextFloat(float minValue, float maxValue);
float NextFloat();
double NextDouble(double minValue, double maxValue);
double NextDouble();
void GetBytes(byte[] data);
byte GetNextByte();
char GetNextChar();
byte[] GetNextByteArray(int size);
char[] GetNextCharArray(int size);

Extensions

Many useful method extensions Example:

//Match
int a = 10;
int b = a.Match(
(x => x == 10, 20),
(x => x == 2, 30)
);

int c = a.Match(
(10, 20), (2, 30)
);

Monadas

NBuilder
NEither
NNone
NOptional
NResult
NSwitcher
NTry

NOptional example

int result = NOptional<int>.OfNullable(10).Filter(x => x != 2).Map(x => x * 2).OrElse(0);
//Result == 20
NOptional<int>.OfNullable(20).Filter(x => x != 20).IfPresent(x => WriteLine(20));
//Nothing

NSwitcher example

private static NSwitcher<SudokuPuzzleLevel> sudokuPuzzleLevelSwitch = OfSwitcher(
            (SudokuLevel.UNKNOWN, SudokuPuzzleLevel.UNKNOWN),
            (SudokuLevel.IDIOTIC, SudokuPuzzleLevel.IDIOTIC),
            (SudokuLevel.VERY_SIMPLE, SudokuPuzzleLevel.VERY_SIMPLE),
            (SudokuLevel.SIMPLY, SudokuPuzzleLevel.SIMPLY),
            (SudokuLevel.MODERATE, SudokuPuzzleLevel.MODERATE),
            (SudokuLevel.NORMAL, SudokuPuzzleLevel.NORMAL),
            (SudokuLevel.HARD, SudokuPuzzleLevel.HARD),
            (SudokuLevel.VERY_HARD, SudokuPuzzleLevel.VERY_HARD),
            (SudokuLevel.EXTREMELY_HARD, SudokuPuzzleLevel.EXTREMELY_HARD)
        );
var result = sudokuPuzzleLevelSwitch
.Match(SudokuLevel.IDIOTIC)
.OrElse(SudokuPuzzleLevel.UNKNOWN)
//Result == SudokuPuzzleLevel.IDIOTIC

License

MIT

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.  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.

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.0.0 402 5/17/2022