TypedMath 1.0.10

dotnet add package TypedMath --version 1.0.10
NuGet\Install-Package TypedMath -Version 1.0.10
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="TypedMath" Version="1.0.10" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add TypedMath --version 1.0.10
#r "nuget: TypedMath, 1.0.10"
#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 TypedMath as a Cake Addin
#addin nuget:?package=TypedMath&version=1.0.10

// Install TypedMath as a Cake Tool
#tool nuget:?package=TypedMath&version=1.0.10

Typed Math

Sometimes when working with calculations I tend to get a touch of Dyscalculia. That is why I loved Visual Basic in the 90s. It had descriptive code, and VB.net does still have it. But I prefer to work with C#. Though I do miss some functions from time to time. To avoid visits from the ghost of Dyscalculia I created this project. At first it seemed like a pretty meaningless project, but soon I realised this could be useful. So, I made it a NuGet. It's all extensions to number types.

LinQ is great and it does offer a lot of ways to make the code more readable, if you use LinQ I see no reason why you should need this package.

Instead of writing

var x = 10 * 32 + y;

you can write

var x = 10.MultipliedWith(32).Add(y);

The package contains namespaces for the most common data types in Visual Studio.

To use the extensions, use any of the namespaces

using MarcusMedinaPro.TypedMath.ByteExtension; // Bytes
using MarcusMedinaPro.TypedMath.CharExtension; // Char
using MarcusMedinaPro.TypedMath.DecimalExtension; // Decimal
using MarcusMedinaPro.TypedMath.DoubleExtension; // Double
using MarcusMedinaPro.TypedMath.IntExtension; // Int
using MarcusMedinaPro.TypedMath.LongExtension; // Long
using MarcusMedinaPro.TypedMath.SByteExtension; // SByte
using MarcusMedinaPro.TypedMath.ShortExtension; // Short
using MarcusMedinaPro.TypedMath.UintExtension; // Uint
using MarcusMedinaPro.TypedMath.UlongExtension; //Ulong
using MarcusMedinaPro.TypedMath.UshorttExtension; //Ushort

Most of the functions have automatic casting from one to another, so you can work with mixed doubles and floats and ints if you want.

Disclaimer

This project is nothing magical most of the functions are one-liners. The idea is not to create special functions, but to make the code easier to read. If you're a hardcore coder that love to minimize your code, this is not for you. But if you feel like you want code that will be easy to read, this might help.

Changes

  • 10190603 - Added array handlers
  • 20190524 - Added Percent, Highest, Lowest, Swap
  • 20190526 - Renamed ChoseHighestValue/ChoseLowestValue to ChoseHighestValueOf/ChoseLowestValueOf. Added SetHighestValueOf/SetLowestValueOf. Swap uses reference now
  • 20190529 - Corrected misspelling in Subtract and added Obsolete tag to the misspelled method. Renamed ChoseHighest/Lowest to ChooseIfHigher/ChooseIfLower

Source code

You can find the code at https://github.com/MarcusMedina/TypedMath

NuGet

The NuGet is available at https://www.nuget.org/packages/TypedMath/

Collaboration

Feel free to add, suggest or request a feature. If you want to help develop this NuGet, feel free to send a Pull Request.

Borrowed code

Borrowed Icons

Cheers. Marcus

Product Compatible and additional computed target framework versions.
.NET Framework net461 is compatible.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 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.10 532 5/7/2020
1.0.9 419 5/7/2020
1.0.8 530 8/8/2019
1.0.6 532 5/29/2019
1.0.3 543 5/23/2019
1.0.2 516 5/14/2019
1.0.1 528 5/14/2019

First release