TrickyMottram.UnitConversion.Temperature 1.0.1

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

TrickyMottram.UnitConversion.Temperature

Temperature unit conversion implementation for the TrickyMottram Unit Conversion libraries.

This package provides an implementation of IUnitConverter and IUnitRegistry for converting between common temperature scales such as Celsius, Fahrenheit, Kelvin, and more. It is part of the TrickyMottram.UnitConversion ecosystem.

✨ Features

  • Supports all major temperature units: Celsius, Fahrenheit, Kelvin, Rankine, Reaumur
  • Includes both strongly typed and symbol-based APIs
  • Compatible with the centralized UnitConversionService
  • Designed for clean architecture and dependency injection
  • Full logging support with Microsoft.Extensions.Logging

🔧 Usage Example

Add to Dependency Injection

services.AddSingleton<IUnitConverter, TemperatureConverter>();
services.AddSingleton<IUnitRegistry, TemperatureUnitRegistry>();

Convert via UnitConversionService

public class TemperatureController : ControllerBase
{
    private readonly UnitConversionService _service;

    public TemperatureController(UnitConversionService service)
    {
        _service = service;
    }

    [HttpGet]
    public IActionResult ConvertTemperature(double value, string from, string to)
    {
        var result = _service.Convert(value, from, to);
        return Ok(result);
    }
}

Strongly Typed Conversion

double fahrenheit = new TemperatureConverter(logger)
    .Convert(100.0, TemperatureUnit.Celsius, TemperatureUnit.Fahrenheit); // 212.0

📚 Main Types

  • TrickyMottram.UnitConversion.Temperature.TemperatureConverter
  • TrickyMottram.UnitConversion.Temperature.Registry.TemperatureUnitRegistry
  • TrickyMottram.UnitConversion.Temperature.Enums.TemperatureUnit
  • TrickyMottram.UnitConversion.Temperature.Extensions.TemperatureUnitExtensions

📦 Package Metadata

  • Target Framework: .NET 8
  • License: MIT
  • Source: GitHub Repository
  • Tags: unit conversion, temperature, celsius, fahrenheit, kelvin, dotnet

✅ Contributing

Contributions for additional temperature units or features are welcome through GitHub Issues or PRs.


© Tricky Mottram

Product Compatible and additional computed target framework versions.
.NET 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 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.

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.1 107 6/7/2025