From c39b538f2b6b7baeaf056f251e7ab31d0cbb7583 Mon Sep 17 00:00:00 2001 From: Simnico99 Date: Wed, 25 Jan 2023 13:52:46 -0500 Subject: [PATCH] Added the Inclusive extension for range. --- src/ZirconNet.Core/Extensions/RangeExtensions.cs | 11 ++++++++++- .../Hosting/AddBackgroundServiceExtension.cs | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/ZirconNet.Core/Extensions/RangeExtensions.cs b/src/ZirconNet.Core/Extensions/RangeExtensions.cs index 0bd1701..48ad5ac 100644 --- a/src/ZirconNet.Core/Extensions/RangeExtensions.cs +++ b/src/ZirconNet.Core/Extensions/RangeExtensions.cs @@ -13,7 +13,16 @@ public static CustomIntEnumerator GetEnumerator(this Range range) #else internal static CustomIntEnumerator GetEnumerator(this Range range) #endif - { + { return new CustomIntEnumerator(range); } + +#if NETCOREAPP3_1_OR_GREATER + public static Range Inclusive(this Range range) +#else + internal static Range Inclusive(this Range range) +#endif + { + return new Range(range.Start, range.End.Value + 1); + } } diff --git a/src/ZirconNet.Core/Hosting/AddBackgroundServiceExtension.cs b/src/ZirconNet.Core/Hosting/AddBackgroundServiceExtension.cs index 2832d9e..48e2df2 100644 --- a/src/ZirconNet.Core/Hosting/AddBackgroundServiceExtension.cs +++ b/src/ZirconNet.Core/Hosting/AddBackgroundServiceExtension.cs @@ -1,6 +1,7 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using System; +using ZirconNet.Core.Extensions; namespace ZirconNet.Core.Hosting; public static class AddBackgroundServiceExtension