-
Notifications
You must be signed in to change notification settings - Fork 380
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add operators extensions to TemperatureGradient and remove duplicates…
… from LapseRate I have removed the TemperatureDelta/Length = LapseRate operator since it would collide with the same overload that equals TemperatureGradient. This is a breaking change, but it was decided that we can do it anyways since it's easy to replace and you will get a compiler error.
- Loading branch information
Showing
4 changed files
with
54 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
UnitsNet/CustomCode/Quantities/TemperatureGradient.extra.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Licensed under MIT No Attribution, see LICENSE file at the root. | ||
// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet. | ||
|
||
namespace UnitsNet | ||
{ | ||
public partial struct TemperatureGradient | ||
{ | ||
/// <summary>Get <see cref="Length"/> from <see cref="TemperatureDelta"/> divided by <see cref="TemperatureGradient"/>.</summary> | ||
public static Length operator /(TemperatureDelta left, TemperatureGradient right) | ||
{ | ||
return Length.FromKilometers(left.Kelvins / right.DegreesCelciusPerKilometer); | ||
} | ||
|
||
/// <summary>Get <see cref="TemperatureDelta"/> from <see cref="Length"/> times <see cref="TemperatureGradient"/>.</summary> | ||
public static TemperatureDelta operator *(Length left, TemperatureGradient right) => right * left; | ||
|
||
/// <summary>Get <see cref="TemperatureDelta"/> from <see cref="TemperatureGradient"/> times <see cref="Length"/>.</summary> | ||
public static TemperatureDelta operator *(TemperatureGradient left, Length right) | ||
{ | ||
return TemperatureDelta.FromDegreesCelsius(left.DegreesCelciusPerKilometer * right.Kilometers); | ||
} | ||
} | ||
} |