Skip to content

Commit 5b0b4d0

Browse files
authored
🗑️Obsolete Quantity.FromQuantityInfo() (#1577)
1 parent e627d7d commit 5b0b4d0

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

CodeGen/Generators/UnitsNetGen/StaticQuantityGenerator.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ public partial class Quantity
4949
/// <param name=""quantityInfo"">The <see cref=""QuantityInfo""/> of the quantity to create.</param>
5050
/// <param name=""value"">The value to construct the quantity with.</param>
5151
/// <returns>The created quantity.</returns>
52+
[Obsolete(""Use Quantity.TryFrom() instead, which takes both the unit and value. It is rarely a good idea to rely on the base unit for anything, it is mostly used internally for unit conversions and can change in future versions. This method will be removed in a future version."")]
5253
public static IQuantity FromQuantityInfo(QuantityInfo quantityInfo, QuantityValue value)
5354
{
5455
return quantityInfo.Name switch

UnitsNet/GeneratedCode/Quantity.g.cs

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)