diff --git a/src/core-taggeds-optional/Optional/Optional.csproj b/src/core-taggeds-optional/Optional/Optional.csproj index 02557a6b..616f8549 100644 --- a/src/core-taggeds-optional/Optional/Optional.csproj +++ b/src/core-taggeds-optional/Optional/Optional.csproj @@ -17,7 +17,7 @@ PrimeFuncPack Core.Optional is a core library for .NET consisting of Optional monad targeted for use in functional programming. System PrimeFuncPack.Core.Optional - 2.2.0-preview.2 + 2.2.0-preview.3 diff --git a/src/core-taggeds-optional/Optional/OptionalLinqExtensions/Inner/InnerElementAtOrAbsent.cs b/src/core-taggeds-optional/Optional/OptionalLinqExtensions/Inner/InnerElementAtOrAbsent.cs index 48112b59..dfc3ce16 100644 --- a/src/core-taggeds-optional/Optional/OptionalLinqExtensions/Inner/InnerElementAtOrAbsent.cs +++ b/src/core-taggeds-optional/Optional/OptionalLinqExtensions/Inner/InnerElementAtOrAbsent.cs @@ -8,23 +8,19 @@ private static Optional InnerElementAtOrAbsent( this IEnumerable source, Index index) => - index.IsFromEnd switch + source switch { - not true => source.InnerElementAtOrAbsent(index.Value), - - _ => source switch - { - IReadOnlyList list - => - list.InnerElementAtOrAbsent_IReadOnlyList(list.Count - index.Value), + IReadOnlyList list + => + list.InnerElementAtOrAbsent_IReadOnlyList(index.GetOffset(list.Count)), - IList list - => - list.InnerElementAtOrAbsent_IList(list.Count - index.Value), + IList list + => + list.InnerElementAtOrAbsent_IList(index.GetOffset(list.Count)), - _ => - source.InnerElementAtOrAbsent_IEnumerable_FromEnd(index.Value) - } + _ => index.IsFromEnd is false + ? source.InnerElementAtOrAbsent_IEnumerable(index.Value) + : source.InnerElementAtOrAbsent_IEnumerable_FromEnd(index.Value) }; private static Optional InnerElementAtOrAbsent( diff --git a/src/core-taggeds/Taggeds/Taggeds.csproj b/src/core-taggeds/Taggeds/Taggeds.csproj index af82f70b..91bcda78 100644 --- a/src/core-taggeds/Taggeds/Taggeds.csproj +++ b/src/core-taggeds/Taggeds/Taggeds.csproj @@ -17,7 +17,7 @@ PrimeFuncPack Core.Taggeds is a core pack for .NET consisting of fundamental tagged types targeted for use in functional programming: Optional and Result monads, Tagged Union, as well as the convert extensions. System PrimeFuncPack.Core.Taggeds - 2.2.0-preview.6 + 2.2.0-preview.7 @@ -33,7 +33,7 @@ - +