AgileCoding.Extentions.Enum
2.0.4
dotnet add package AgileCoding.Extentions.Enum --version 2.0.4
NuGet\Install-Package AgileCoding.Extentions.Enum -Version 2.0.4
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="AgileCoding.Extentions.Enum" Version="2.0.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add AgileCoding.Extentions.Enum --version 2.0.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: AgileCoding.Extentions.Enum, 2.0.4"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install AgileCoding.Extentions.Enum as a Cake Addin #addin nuget:?package=AgileCoding.Extentions.Enum&version=2.0.4 // Install AgileCoding.Extentions.Enum as a Cake Tool #tool nuget:?package=AgileCoding.Extentions.Enum&version=2.0.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
AgileCoding.Extensions.Enums NuGet Package
This NuGet package offers a range of helpful extension methods to work with enums in .NET applications.
Features
The EnumExtension
static class provides several methods for enhancing the functionality and versatility of enums in your application:
SetWithStringValue<EnumType>()
: Set an enum with a string value.SetWithStringValue<EnumType, IExceptionType>()
: Set an enum with a string value and provide an error message if an error occurs.ValidateEnumEqualToAny<TEnum, IExceptionType>()
: Validates if an enum is equal to any value from a given list of enums.InAny<TEnum>()
: Checks if an enum exists in a given list of enums.ThrowIfEqualTo<TEnum, IExceptionType>()
: Throws an exception if the enum is equal to a specific value.GetAllEnumsContainingAttribute<ANYType>()
: Returns all enums containing a specified attribute value.
How to Use
Here's a simple example of how to use the SetWithStringValue<EnumType>()
method:
using AgileCoding.Extentions.Enums;
public enum MyEnum
{
Value1,
Value2
}
// To use the extension method:
MyEnum myEnum = MyEnum.Value1;
myEnum = myEnum.SetWithStringValue("Value2");
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net6.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on AgileCoding.Extentions.Enum:
Package | Downloads |
---|---|
AgileCoding.Factory.ClientProxy
Factories that create service proxies |
GitHub repositories
This package is not used by any popular GitHub repositories.
Moving to core