Converter.Temperature 3.2.50

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

// Install Converter.Temperature as a Cake Tool
#tool nuget:?package=Converter.Temperature&version=3.2.50                

README

Converter.Temperature This project was created to extract out the main conversion code from the Temperature Converter applications in the other repositories. I am using this as a way to show how my development skills have changed over the years, as I get to be a better developer.

Introduction

These extension methods will convert different types of temperatures to other types.

Temperature types

  • Celsius
  • Fahrenheit
  • Kelvin
  • Gas
  • Rankine
  • Rømer

Data types

  • int
  • long
  • float
  • double
  • string

Ideas

I had a few ideas on how to do the extension methods but decided on using a fluent style.

Originally, the extensions looked like this:

    var tempToConvert = 34; // an int.
    var convertedTemp = tempToConvert.CelsiusToFahrenheit();

Then I thought that this looked a bit naf so, I went with setting up the from first, then the to. This follows the fluent pattern.

Now it is used like this:

    var tempToConvert = 34; // an int.
    var convertedTemp = tempToConvert.FromCelsius().ToFahrenheit();

The next stage for version 2 is to add an additional usage like this:

    var tempToConvert = 34; // an int.
    var convertedTemp = tempToConvert.From<Celsius>().To<Fahrenheit>();

What to do for edge cases

I'm working on what I want the library to do when an exception could be thrown. This is when we have the edge cases of values that are too small or too large for the type being converted to.

E.g.:

From a float type with a value close to the max value of a float, converted from Celsius to Fahrenheit. Because a Fahrenheit value is greater than the celsius value, then we can't convert correctly.

Should this throw an exception or just return the original value?

Well, returning the same value would seem like all is well, even though the converted value is wrong. Thinking about this means that for me, it should throw an exception for the calling application to handle.

If anyone has any better ideas, then I would be willing to change this behaviour.

More Information

For more information on the project and where it is heading, see the wiki.

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 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
3.2.50 132 4/7/2024
3.1.39 109 3/23/2024
3.0.0 1,974 11/16/2022
2.1.1 453 6/3/2022
2.0.1 467 4/21/2022
2.0.0 283 1/8/2022
1.1.0 323 12/2/2021

See the details at the following link.

           https://github.com/Daeer-Projects/Converter.Temperature/wiki/Release-Notes

           Pay particular attention to the changes made for Issue 60 in the release notes.