TrickyMottram.UnitConversion.Power
1.0.1
dotnet add package TrickyMottram.UnitConversion.Power --version 1.0.1
NuGet\Install-Package TrickyMottram.UnitConversion.Power -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.Power" 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.Power" Version="1.0.1" />
<PackageReference Include="TrickyMottram.UnitConversion.Power" />
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.Power --version 1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: TrickyMottram.UnitConversion.Power, 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.Power&version=1.0.1
#tool nuget:?package=TrickyMottram.UnitConversion.Power&version=1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
TrickyMottram.UnitConversion.Power
Power unit conversion implementation for the TrickyMottram Unit Conversion libraries.
This package provides an implementation of IUnitConverter
and IUnitRegistry
for converting between various power units including metric (watts, kilowatts), mechanical (horsepower), and energy-rate based units. It is part of the TrickyMottram.UnitConversion ecosystem.
✨ Features
- Supports units like milliwatt, watt, kilowatt, megawatt, gigawatt, horsepower, BTU/hr, calorie/sec
- Offers both string and strongly typed enum conversion methods
- Integrates easily with
UnitConversionService
- Clean architecture, DI-ready, and logging enabled
- Unit registry support for UI binding and unit discovery
🔧 Usage Example
Add to Dependency Injection
services.AddSingleton<IUnitConverter, PowerConverter>();
services.AddSingleton<IUnitRegistry, PowerUnitRegistry>();
Convert via UnitConversionService
public class PowerController : ControllerBase
{
private readonly UnitConversionService _service;
public PowerController(UnitConversionService service)
{
_service = service;
}
[HttpGet]
public IActionResult ConvertPower(double value, string from, string to)
{
var result = _service.Convert(value, from, to);
return Ok(result);
}
}
Strongly Typed Conversion
double megawatts = new PowerConverter(logger)
.Convert(1_000_000, PowerUnit.Watt, PowerUnit.Megawatt); // 1.0
📚 Main Types
TrickyMottram.UnitConversion.Power.PowerConverter
TrickyMottram.UnitConversion.Power.Registry.PowerUnitRegistry
TrickyMottram.UnitConversion.Power.Enums.PowerUnit
TrickyMottram.UnitConversion.Power.Extensions.PowerUnitExtensions
📦 Package Metadata
- Target Framework:
.NET 8
- License: MIT
- Source: GitHub Repository
- Tags:
unit conversion
,power
,watt
,horsepower
,dotnet
✅ Contributing
Contributions for additional power units or improvements are welcome via GitHub Issues.
© Tricky Mottram
Product | Versions 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.
-
net8.0
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.5)
- TrickyMottram.UnitConversion.Abstractions (>= 1.0.1)
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 | 69 | 6/20/2025 |