Enums
Introduction
This page is about enumerations included in LeoCorpLibrary.
The Enums namespace
Starting with version 4.4, all enums of LeoCorpLibrary have been moved to their own dedicated namespace. If you are upgrading from an older version of LeoCorpLibrary, you'll need to include the LeoCorpLibrary.Enums or LeoCorpLibrary.Core.Enums namespace if you want to use any enumerations:
C#
using LeoCorpLibrary.Enums;
VB
Imports LeoCorpLibrary.Enums
Note
In this documentation, most of the enumerations are available since version 4.4, in fact, most of these enumerations are available from the first versions of LeoCorpLibrary.
a. WindowsVersion
This enumeration is available in version 1.9 and higher.
Compatibility
| Frameworks | LeoCorpLibrary | LeoCorpLibrary.Core |
|---|---|---|
| .NET 6 | ✔ | ✔ |
| .NET 5 | ✔ | ✔ |
| .NET Core 3.1 | ✔ | ✔ |
| .NET Framework 4.5 | ✔ | ✔ |
The WindowsVersion enumeration is used to represent all major versions of Windows. It has the following values:
Windows7Windows8Windows81Windows10Windows11
| Enumeration value | Meaning |
|---|---|
WindowsVersion.Windows7 | Microsoft Windows NT 6.1 |
WindowsVersion.Windows8 | Microsoft Windows NT 6.2 |
WindowsVersion.Windows81 | Microsoft Windows NT 6.3 |
WindowsVersion.Windows10 | Microsoft Windows NT 10.0 |
WindowsVersion.Windows11 | Microsoft Windows NT 10.0.22000 and higher |
b. TimeUnits
This enumeration is available in version 4.3 and higher.
Compatibility
| Frameworks | LeoCorpLibrary | LeoCorpLibrary.Core |
|---|---|---|
| .NET 6 | ✔ | ✔ |
| .NET 5 | ✔ | ✔ |
| .NET Core 3.1 | ✔ | ✔ |
| .NET Framework 4.5 | ✔ | ✔ |
The TimeUnits enumeration is used to represent different time units. It has the following values:
MillisecondsSecondsMinutesHoursDays
| Enumeration value | Meaning |
|---|---|
TimeUnits.Milliseconds | Represent the Milliseconds time unit |
TimeUnits.Seconds | Represent the Seconds time unit |
TimeUnits.Minutes | Represent the Minutes time unit |
TimeUnits.Hours | Represent the Hours time unit |
TimeUnits.Days | Represent the Days time unit |
c. SystemThemes
This enumeration is available in version 4.4 and higher.
Compatibility
| Frameworks | LeoCorpLibrary | LeoCorpLibrary.Core |
|---|---|---|
| .NET 6 | ✔ | ✔ |
| .NET 5 | ✔ | ✔ |
| .NET Core 3.1 | ✔ | ✔ |
| .NET Framework 4.5 | ✔ | ✔ |
The SystemThemes enumeration is used to represent different Windows themes. It has the following values:
DarkLightUnknown
| Enumeration value | Meaning |
|---|---|
SystemThemes.Dark | The Windows theme is dark |
SystemThemes.Light | The Windows theme is light |
SystemThemes.Unknown | The theme of the current operating system cannot be determined |
d. OperatingSystems
This enumeration is available in version 4.4 and higher.
Compatibility
| Frameworks | LeoCorpLibrary | LeoCorpLibrary.Core |
|---|---|---|
| .NET 6 | ✔ | ✔ |
| .NET 5 | ✔ | ✔ |
| .NET Core 3.1 | ✔ | ✔ |
| .NET Framework 4.5 | ✔ | ✔ |
The OperatingSystems enumeration is used to represent different operating systems. It has the following values:
WindowsmacOSLinuxUnknown
| Enumeration value | Meaning |
|---|---|
OperatingSystems.Windows | The Windows operating system |
OperatingSystems.macOS | The macOS operating system |
OperatingSystems.Linux | The Linux operating system/Linux based distribution |
OperatingSystems.Unknown | The current operating system cannot be determined |
e. UnitType
This enumeration is available in version 4.4 and higher.
Compatibility
| Frameworks | LeoCorpLibrary | LeoCorpLibrary.Core |
|---|---|---|
| .NET 6 | ✔ | ✔ |
| .NET 5 | ✔ | ✔ |
| .NET Core 3.1 | ✔ | ✔ |
| .NET Framework 4.5 | ✔ | ✔ |
The UnitTime enumeration is used to represent different storage units (kb, mb, gb...). It has the following values:
ByteKilobyteMegabyteGigabyteTerabytePetabyte
f. ControlAlignment
This enumeration is available in version 4.4 and higher.
Compatibility
| Frameworks | LeoCorpLibrary | LeoCorpLibrary.Core |
|---|---|---|
| .NET 6 | ✔ | ❌ |
| .NET 5 | ✔ | ❌ |
| .NET Core 3.1 | ✔ | ❌ |
| .NET Framework 4.5 | ✔ | ❌ |
The ControlAlignment enumeration is used to represent different System.Windows.Forms.Control alignment. It has the following values:
HorizontalVerticalBoth
| Enumeration value | Meaning |
|---|---|
ControlAlignment.Horizontal | The control will be aligned horizontally |
ControlAlignment.Vertical | The control will be aligned vertically |
ControlAlignment.Both | The control will be aligned horizontally and vertically |
Note
This enumeration is made for Windows Forms project.
g. StatusCodeType
This enumeration is available in version 4.4 and higher.
Compatibility
| Frameworks | LeoCorpLibrary | LeoCorpLibrary.Core |
|---|---|---|
| .NET 6 | ✔ | ✔ |
| .NET 5 | ✔ | ✔ |
| .NET Core 3.1 | ✔ | ✔ |
| .NET Framework 4.5 | ✔ | ✔ |
The StatusCodeType enumeration is used to represent different status codes when making a request to a website. It has the following values:
InformationalSuccessRedirectionClientErrorServerError
Learn more about status codes.
| Enumeration value | Meaning |
|---|---|
StatusCodeType.Informational | The status code is similar to 1xx. |
StatusCodeType.Success | The status code is similar to 2xx. |
StatusCodeType.Redirection | The status code is similar to 3xx. |
StatusCodeType.ClientError | The status code is similar to 4xx. |
StatusCodeType.ServerError | The status code is similar to 5xx. |
Here's an example of usage:
C#
StatusCodeType statusType = NetworkConnection.GetStatusCodeType("https://leocorporation.dev");
switch (statusType)
{
case StatusCodeType.Informational:
Console.WriteLine("Information message.");
break;
case StatusCodeType.Success:
Console.WriteLine("Success message.");
break;
case StatusCodeType.Redirection:
Console.WriteLine("Redirection message.");
break;
case StatusCodeType.ClientError:
Console.WriteLine("Client error message.");
break;
case StatusCodeType.ServerError:
Console.WriteLine("Server error message.");
break;
}
VB
Dim statusType As StatusCodeType = NetworkConnection.GetStatusCodeType("https://leocorporation.dev")
Select Case statusType
Case StatusCodeType.Informational
Console.WriteLine("Information message.")
Case StatusCodeType.Success
Console.WriteLine("Success message.")
Case StatusCodeType.Redirection
Console.WriteLine("Redirection message.")
Case StatusCodeType.ClientError
Console.WriteLine("Client error message.")
Case StatusCodeType.ServerError
Console.WriteLine("Server error message.")
End Select
h. PasswordPresets
This enumeration is available in version 4.4 and higher.
Compatibility
| Frameworks | LeoCorpLibrary | LeoCorpLibrary.Core |
|---|---|---|
| .NET 6 | ✔ | ✔ |
| .NET 5 | ✔ | ✔ |
| .NET Core 3.1 | ✔ | ✔ |
| .NET Framework 4.5 | ✔ | ✔ |
The PasswordPresets enumeration is used to represent the complexity of a password. It has the following values:
SimpleComplex
| Enumeration value | Meaning |
|---|---|
PasswordPresets.Simple | This preset will generate a password with simple characters (abc, 123). |
PasswordPresets.Complex | This preset will generate a strong password with unusual, hard and complex characters (abc, 123, àçé, {[@) |
i. PasswordStrength
This enumeration is available in version 4.4 and higher.
Compatibility
| Frameworks | LeoCorpLibrary | LeoCorpLibrary.Core |
|---|---|---|
| .NET 6 | ✔ | ✔ |
| .NET 5 | ✔ | ✔ |
| .NET Core 3.1 | ✔ | ✔ |
| .NET Framework 4.5 | ✔ | ✔ |
The PasswordStrength enumeration is used to evaluate how strong a password is. It has the following values:
VeryGoodGoodMediumLowUnknown
| Enumeration value | Meaning |
|---|---|
PasswordStrength.VeryGood | The password is uncommon, strong |
PasswordStrength.Good | The password is complex, could be stronger |
PasswordStrength.Medium | The password could be more complex. |
PasswordStrength.Low | The password is too easy, not strong, you shouldn't use it |
PasswordStrength.Unknown | Cannot determine the strength of the password |