Unit Converter: Documentation

Adding the package

  • At the Nuget Package manager window, type “unit converter”, the package is shown.
  • Install and add to the class.

Available Units

  • Area
  • DataStorage
  • DataTransfer
  • Energy
  • Frequency
  • Fuel Economy
  • Length
  • Plane Angle
  • Pressure
  • Quantity
  • Speed
  • Temperature
  • Volume
  • Weight

Setting and getting the value

  • Define the value of an unit.

  • All other derived values are available.

Output

That is it till now.

Version 2.0.0

A new method is introduced in all converter class named “Calculate()”. It takes the  value and the unit as parameter and avail the other values.

Example

Benefit

All the enum provided, has a unique ID so it can be stored in the database while saving the value and if maintained a inventory or something like that, that id can be directly passed to retrived the converted value.

Let us consider the following class as database table,

And see the following lines of code

It will show the output as excepted. Here the unit ID was 403 for the meter