-
Notifications
You must be signed in to change notification settings - Fork 404
-
I just wonder if you already have the gauge pressure measurement?
Beta Was this translation helpful? Give feedback.
All reactions
You can parse and use the UnitConverter
on the Pressure
type, which is the standard IQuantity
. The ReferencePressure
is a wrapper that doesn't implement the IQuantity
interface (as it contains more than a Unit
and Value
).
Replies: 1 comment 2 replies
-
We have a wrapper for Pressure
, see
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1
-
Can it use parser to create IQuantity to use by UnitConverter? I write the VB.Net code as below. Please give me an advise. Thank you.
Public Function ConvertUnit(value As Double, fromUnit As String, toUnit As String
) As Double
Try
' Dynamically parse the quantity type based on the fromUnit
Dim inputQuantity As IQuantity = UnitsNet.Quantity.FromUnitAbbreviation(value, fromUnit)
Dim type = inputQuantity.GetType().Name
Dim convertedValue = UnitConverter.ConvertByAbbreviation(value, type, fromUnit, toUnit)
Return convertedValue
Catch ex As Exception
Return ex.Message
End Try
End Function
Beta Was this translation helpful? Give feedback.
All reactions
-
You can parse and use the UnitConverter
on the Pressure
type, which is the standard IQuantity
. The ReferencePressure
is a wrapper that doesn't implement the IQuantity
interface (as it contains more than a Unit
and Value
).
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1