Description
Provides helper methods for a quantity.
Public Methods
Add | Adds the value from the IAgQuantity interface to this interface. Returns a new IAgQuantity. The dimensions must be similar. |
ConvertToUnit | Changes the value in this quantity to the specified unit. |
DivideQty | Divides the value from the IAgQuantity interface to this interface. The dimensions must be similar. |
MultiplyQty | Multiplies the value from the IAgQuantity interface to this interface. Returns a new IAgQuantity. The dimensions must be similar. |
Subtract | Subtracts the value from the IAgQuantity interface to this interface. Returns a new IAgQuantity. The dimensions must be similar. |
Public Properties
Dimension | Gets the name of the dimension |
Unit | The current Unit abbreviation. |
Value | The current value. |
Example
Calculate quantity addition (with IAgQuantity)
| [C#] | Copy Code |
|---|
IAgQuantity race3mi = root.ConversionUtility.NewQuantity("Distance", "mi", 3.1);
IAgQuantity race5km = root.ConversionUtility.NewQuantity("Distance", "km", 5);
IAgQuantity race10km = race5km.Add(race3mi);
Console.Write("The {0} {1} race is also called a ", race10km.Value, race10km.Unit);
race10km.ConvertToUnit("mi");
Console.WriteLine("{0} {1} race", race10km.Value, race10km.Unit);
|
|
Calculate quantity addition (with IAgQuantity)
| [Visual Basic .NET] | Copy Code |
|---|
Dim race3mi As IAgQuantity = root.ConversionUtility.NewQuantity("Distance", "mi", 3.1) Dim race5km As IAgQuantity = root.ConversionUtility.NewQuantity("Distance", "km", 5)
Dim race10km As IAgQuantity = race5km.Add(race3mi) Console.Write("The {0} {1} race is also called a ", race10km.Value, race10km.Unit)
race10km.ConvertToUnit("mi") Console.WriteLine("{0} {1} race", race10km.Value, race10km.Unit)
|
|