VOOZH about

URL: https://www.nuget.org/packages/EgonsoftHU.Extensions.Bcl/

⇱ NuGet Gallery | EgonsoftHU.Extensions.Bcl 3.0.1




EgonsoftHU.Extensions.Bcl 3.0.1

Prefix Reserved

Requires NuGet 4.1.0 or higher.

dotnet add package EgonsoftHU.Extensions.Bcl --version 3.0.1
 
 
NuGet\Install-Package EgonsoftHU.Extensions.Bcl -Version 3.0.1
 
 
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="EgonsoftHU.Extensions.Bcl" Version="3.0.1" />
 
 
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="EgonsoftHU.Extensions.Bcl" Version="3.0.1" />
 
Directory.Packages.props
<PackageReference Include="EgonsoftHU.Extensions.Bcl" />
 
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add EgonsoftHU.Extensions.Bcl --version 3.0.1
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: EgonsoftHU.Extensions.Bcl, 3.0.1"
 
 
#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.
#:package EgonsoftHU.Extensions.Bcl@3.0.1
 
 
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=EgonsoftHU.Extensions.Bcl&version=3.0.1
 
Install as a Cake Addin
#tool nuget:?package=EgonsoftHU.Extensions.Bcl&version=3.0.1
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Egonsoft.HU BCL Extensions

C# extension methods for Base Class Library types.

Summary

  • Extension methods for throwing ArgumentNullException
  • Extension methods for throwing ArgumentException
  • Extension methods for throwing ArgumentOutOfRangeException
  • Extension methods for specific types
  • Extension methods with generic type parameters
  • Predefined (const / readonly) values
  • More information

Extension methods for throwing ArgumentNullException or ArgumentException

  • For generic T type:
    • ThrowIfNull<T>() throws ArgumentNullException
  • For System.String type:
    • ThrowIfNullOrEmpty() throws ArgumentNullException or ArgumentException
    • ThrowIfNullOrWhiteSpace() throws ArgumentNullException or ArgumentException
  • For System.Guid type:
    • ThrowIfEmptyGuid() throws ArgumentException

Extension methods for throwing ArgumentOutOfRangeException

Would you like to use the new static methods in ArgumentOutOfRangeException that were introduced in .NET 8 but your project targets an older framework? In this package they are available as extension methods.

  • For IEquatable<T> type:
    • ThrowIfEqualTo()
    • ThrowIfNotEqualTo()
  • For IComparable<T> type:
    • ThrowIfLessThan()
    • ThrowIfLessThanOrEqualTo()
    • ThrowIfGreaterThan
    • ThrowIfGreaterThanOrEqualTo()
  • For numeric types:
    System.SByte, System.Int16, System.Int32, System.Int64,
    System.Byte, System.UInt16, System.UInt32, System.UInt64,
    System.Half, System.Single, System.Double, System.Decimal
    • ThrowIfZero()
    • ThrowIfNegative()
    • ThrowIfNegativeOrZero()
    • ThrowIfPositive()
    • ThrowIfPositiveOrZero()

Extension methods for specific types

This package contains extension methods for these types:

  • System.Collections.Generic.ICollection<T>
    • AddRange()
  • System.Collections.Generic.IDictionary<TKey, TValue>
    • AsReadOnly()
    • AsSorted()
    • DefaultIfKeyNotFound()
    • GetOrThrow()
  • System.Collections.Generic.IEnumerable<T>
    • IsNullOrEmpty()
    • DetectChanges() - Get new, existing and removed items.
  • System.Collections.Generic.IList<T>
    • AsReadOnly() up to .NET 6 (An extension method with the same signature is part of .NET 7+.)
  • System.DateOnly
    • IsInRange()
  • System.DateTime
    • IsInRange()
    • ToMinutePrecision()
    • ToSecondPrecision()
  • System.DateTimeOffset
    • IsInRange()
    • ToMinutePrecision()
    • ToSecondPrecision()
  • System.Exception
    • GetHttpStatusCode()
    • SetHttpStatusCode()
  • System.IO.Stream
    • ToByteArray()
    • ToByteArrayAsync()
    • TryResetStreamPosition()
  • System.Reflection.Assembly
  • System.Reflection.MemberInfo
  • System.Reflection.ParameterInfo
  • System.String
    • IsNullOrEmpty()
    • IsNullOrWhiteSpace()
    • DefaultIfNullOrEmpty()
    • DefaultIfNullOrWhiteSpace()
    • EnsureTrailingSlash()
    • EnsureNoTrailingSlash()
  • System.Type
    • AsNullableValueType()
    • IsNullableValueType()
  • Numeric types:
    System.SByte, System.Int16, System.Int32, System.Int64,
    System.Byte, System.UInt16, System.UInt32, System.UInt64,
    System.Half, System.Single, System.Double, System.Decimal
    • IsZero()
    • IsNegative()
    • IsNegativeOrZero()
    • IsPositive()
    • IsPositiveOrZero()
    • IsInRange()

Extension methods with generic type parameters

  • IEnumerable-related
    • AsSingleElementSequence()
    • IsIn()
    • IsNotIn()
  • Reflection-related
    • GetPropertyValue()
    • TryPropertyValue()
    • SetPropertyValue()
    • TrySetPropertyValue()
  • value selectors
    • GetStringValueOrNull()
    • GetStringValueOrEmptyString()
    • GetValueOrDefault()
    • GetValue()

Predefined (const / readonly) values

  • Chars
  • DateTimeFormats
  • GenericTypeDefinitions
  • GuidFormats
  • HttpStatusCodes
  • Strings

enum types

  • IntervalBoundsOptions - can be used in the new IsInRange() extension methods.

Other types

  • EnumInfo<TEnum>
    • A wrapper class that provides additional information about an enum type or value.
      • The custom attributes applied to a member.
      • Easy access to the list of the defined members.
      • Easy access to the name or the underlying value of a member.
      • Support for customizing the serialized value through attributes.
      • Implements bitwise / comparison / implicit conversion / equality operators.
  • EncodingProvider
    • UTF8WithoutBOM The UTF-8 encoding without the Unicode byte order mark.
  • StringSyntaxAttribute
    • up to .NET 6 (This attribute is part of .NET 7+.)
  • StructuralEqualityComparer<T>
    • Provides a generic IEqualityComparer<T> instance for using the non-generic System.Collections.StructuralComparisons.StructuralEqualityComparer.
  • TypeHelper
    • GetName<T>() / GetName(Type) methods as a shortcut for Type.FullName ?? Type.Name expression.

More information

Learn more at https://github.com/gcsizmadia/EgonsoftHU.Extensions.Bcl

Product Versions Compatible and additional computed target framework versions.
.NET net5.0 net5.0 was computed.  net5.0-windows net5.0-windows was computed.  net6.0 net6.0 is compatible.  net6.0-android net6.0-android was computed.  net6.0-ios net6.0-ios was computed.  net6.0-maccatalyst net6.0-maccatalyst was computed.  net6.0-macos net6.0-macos was computed.  net6.0-tvos net6.0-tvos was computed.  net6.0-windows net6.0-windows was computed.  net7.0 net7.0 was computed.  net7.0-android net7.0-android was computed.  net7.0-ios net7.0-ios was computed.  net7.0-maccatalyst net7.0-maccatalyst was computed.  net7.0-macos net7.0-macos was computed.  net7.0-tvos net7.0-tvos was computed.  net7.0-windows net7.0-windows was computed.  net8.0 net8.0 is compatible.  net8.0-android net8.0-android was computed.  net8.0-browser net8.0-browser was computed.  net8.0-ios net8.0-ios was computed.  net8.0-maccatalyst net8.0-maccatalyst was computed.  net8.0-macos net8.0-macos was computed.  net8.0-tvos net8.0-tvos was computed.  net8.0-windows net8.0-windows was computed.  net9.0 net9.0 was computed.  net9.0-android net9.0-android was computed.  net9.0-browser net9.0-browser was computed.  net9.0-ios net9.0-ios was computed.  net9.0-maccatalyst net9.0-maccatalyst was computed.  net9.0-macos net9.0-macos was computed.  net9.0-tvos net9.0-tvos was computed.  net9.0-windows net9.0-windows was computed.  net10.0 net10.0 was computed.  net10.0-android net10.0-android was computed.  net10.0-browser net10.0-browser was computed.  net10.0-ios net10.0-ios was computed.  net10.0-maccatalyst net10.0-maccatalyst was computed.  net10.0-macos net10.0-macos was computed.  net10.0-tvos net10.0-tvos was computed.  net10.0-windows net10.0-windows was computed. 
.NET Core netcoreapp2.0 netcoreapp2.0 was computed.  netcoreapp2.1 netcoreapp2.1 was computed.  netcoreapp2.2 netcoreapp2.2 was computed.  netcoreapp3.0 netcoreapp3.0 was computed.  netcoreapp3.1 netcoreapp3.1 is compatible. 
.NET Standard netstandard2.0 netstandard2.0 is compatible.  netstandard2.1 netstandard2.1 is compatible. 
.NET Framework net461 net461 was computed.  net462 net462 is compatible.  net463 net463 was computed.  net47 net47 was computed.  net471 net471 was computed.  net472 net472 was computed.  net48 net48 was computed.  net481 net481 was computed. 
MonoAndroid monoandroid monoandroid was computed. 
MonoMac monomac monomac was computed. 
MonoTouch monotouch monotouch was computed. 
Tizen tizen40 tizen40 was computed.  tizen60 tizen60 was computed. 
Xamarin.iOS xamarinios xamarinios was computed. 
Xamarin.Mac xamarinmac xamarinmac was computed. 
Xamarin.TVOS xamarintvos xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on EgonsoftHU.Extensions.Bcl:

Package Downloads
EgonsoftHU.Extensions.DependencyInjection.Abstractions

Abstractions for dependency injection. Commonly Used Types: EgonsoftHU.Extensions.DependencyInjection.IAssemblyRegistry EgonsoftHU.Extensions.DependencyInjection.DefaultAssemblyRegistry

EgonsoftHU.Extensions.Logging.Serilog

Serilog.ILogger extensions: - Enrich log events with the name of the source member (method, property, etc.) in which the log event occurs. - Enrich log events with multiple properties at once using PropertyBagEnricher. - Populate Exception.Data dictionary with the log event properties.

EgonsoftHU.Text.Json

System.Text.Json extensions. Supports any attribute for enum member serialization. Provides option for using your own custom serializer implementation for enum members. Built-in attribute support: System.Text.Json.Serialization.JsonStringEnumMemberNameAttribute (>= 9.0.0) System.Runtime.Serialization.EnumMemberAttribute System.ComponentModel.DescriptionAttribute System.ComponentModel.DisplayNameAttribute System.ComponentModel.DataAnnotations.DisplayAttribute Commonly Used Types: EgonsoftHU.Text.Json.Serialization.JsonStringEnumConverter EgonsoftHU.Text.Json.Serialization.Converters.JsonEnumValueSerializer EgonsoftHU.Text.Json.JsonSerializerOptionsProvider

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.0.1 714 10/14/2024
3.0.0 302 9/13/2024
2.1.0 742 8/27/2023
2.0.0 7,168 6/21/2022
1.0.3 1,256 5/4/2022
1.0.2 5,880 3/13/2022
1.0.1 1,075 3/2/2022
1.0.0 1,018 2/4/2022