Units conversions - Leo-Corporation/LeoCorpLibrary GitHub Wiki
To use these methods and features, do not forget to put this line of code on top of your code file:
C#
using LeoCorpLibrary;VB
Imports LeoCorpLibraryThis function is available in version 3.9 and higher.
Compatibility
| Framework | LeoCorpLibrary | LeoCorpLibrary.Core |
|---|---|---|
| .NET 5 | ✔ | ✔ |
| .NET Core 3.1 | ✔ | ✔ |
| .NET Framework 4.7.2 | ✔ | ✔ |
| .NET Framework 4.5 | ❌ | ✔ |
This methods allows you to convert miles to kilometers. It returns a double value.
It's in:
LeoCorpLibrary.UnitsConversions.MilesToKm()This method has one argument:
| Type | Argument | Description |
|---|---|---|
| double | miles | Number of mile(s) to convert |
Here's an example of usage:
C#
double km = UnitsConversions.MilesToKm(10);
// Expected result:
// 16.09344 kmVB
Dim km As Double = UnitsConversions.MilesToKm(10)
' Expected result:
' 16.09344 kmThis function is available in version 3.9 and higher.
Compatibility
| Framework | LeoCorpLibrary | LeoCorpLibrary.Core |
|---|---|---|
| .NET 5 | ✔ | ✔ |
| .NET Core 3.1 | ✔ | ✔ |
| .NET Framework 4.7.2 | ✔ | ✔ |
| .NET Framework 4.5 | ❌ | ✔ |
This method allows you to convert kilometers to miles. It return a doublevalue.
It's in:
LeoCorpLibrary.UnitsConversions.KmToMiles()This method has one argument:
| Type | Argument | Description |
|---|---|---|
| double | kilometers | Number of kilometers(s) to convert |
Here's an example of usage:
C#
double miles = UnitsConversions.KmToMiles(10);
// Expected result :
// 6.2137119223733395 milesVB
Dim miles As Double = UnitsConversions.KmToMiles(10)
' Expected result :
' 6.2137119223733395 milesThis function is available in version 3.9 and higher.
Compatibility
| Framework | LeoCorpLibrary | LeoCorpLibrary.Core |
|---|---|---|
| .NET 5 | ✔ | ✔ |
| .NET Core 3.1 | ✔ | ✔ |
| .NET Framework 4.7.2 | ✔ | ✔ |
| .NET Framework 4.5 | ❌ | ✔ |
This method allows you to convert Celsius (°C) to Fahrenheit (°F). It returns a double value.
It's in:
LeoCorpLibrary.UnitsConversions.CelsiusToFahrenheit()This method has one argument:
| Type | Argument | Description |
|---|---|---|
| double | celsius | Number of celsius to convert |
Here's an example of usage:
C#
double f = UnitsConversions.CelsiusToFahrenheit(25);
// Expected result:
// 77°FVB
Dim f As Double = UnitsConversions.CelsiusToFahrenheit(25)
' Expected result:
' 77°FThis function is available in version 3.9 and higher.
Compatibility
| Framework | LeoCorpLibrary | LeoCorpLibrary.Core |
|---|---|---|
| .NET 5 | ✔ | ✔ |
| .NET Core 3.1 | ✔ | ✔ |
| .NET Framework 4.7.2 | ✔ | ✔ |
| .NET Framework 4.5 | ❌ | ✔ |
This method allows you to convert Fahrenheit (°F) to Celsius (°C). It returns a double value.
It's in:
LeoCorpLibrary.UnitsConversions.FahrenheitToCelsius()This method has one argument:
| Type | Argument | Description |
|---|---|---|
| double | fahrenheit | Number of fahrenheit to convert |
Here's an example of usage:
C#
double c = UnitsConversions.FahrenheitToCelsius(68);
// Expected result:
// 20°CVB
Dim c As Double = UnitsConversions.FahrenheitToCelsius(68)
' Expected result:
' 20°CThis function is available in version 3.9 and higher.
Compatibility
| Framework | LeoCorpLibrary | LeoCorpLibrary.Core |
|---|---|---|
| .NET 5 | ✔ | ✔ |
| .NET Core 3.1 | ✔ | ✔ |
| .NET Framework 4.7.2 | ✔ | ✔ |
| .NET Framework 4.5 | ❌ | ✔ |
This method allows you to convert Cubic meters (m³) to Litre (L). It returns a double value.
It's in:
LeoCorpLibrary.UnitsConversions.M3ToLitre()This method has one argument:
| Type | Argument | Description |
|---|---|---|
| double | m3 | Number of cubic meter(s) to convert |
Here's an example of usage:
C#
double l = UnitsConversions.M3ToLitre(10);
// Expected result:
// 10000LVB
Dim l As Double = UnitsConversions.M3ToLitre(10)
' Expected result:
' 10000LThis function is available in version 3.9 and higher.
Compatibility
| Framework | LeoCorpLibrary | LeoCorpLibrary.Core |
|---|---|---|
| .NET 5 | ✔ | ✔ |
| .NET Core 3.1 | ✔ | ✔ |
| .NET Framework 4.7.2 | ✔ | ✔ |
| .NET Framework 4.5 | ❌ | ✔ |
This method allows you to convert Litre (L) to Cubic meters (m³). It returns a double value.
It's in:
LeoCorpLibrary.UnitsConversions.LitreToM3()This method has one argument:
| Type | Argument | Description |
|---|---|---|
| double | Number of mile(s) to convert |
Here's an example of usage:
C#
double m3 = UnitsConversions.LitreToM3(2500);
// Expected result:
// 2.5 m³VB
Dim m3 As Double = UnitsConversions.LitreToM3(2500)
' Expected result:
' 2.5 m³