From a54b7ac4ca3a05bcf2c4a03ae7aa4bd99d78c363 Mon Sep 17 00:00:00 2001 From: Barion Date: Mon, 18 Nov 2024 17:27:35 +0100 Subject: [PATCH] Drop .NET 8 support --- src/Ametrin.Optional.csproj | 2 +- src/Extensions/DictionaryExtensions.cs | 2 -- src/Operations/Or.cs | 6 ------ 3 files changed, 1 insertion(+), 9 deletions(-) diff --git a/src/Ametrin.Optional.csproj b/src/Ametrin.Optional.csproj index 17cc2ed..5fff724 100644 --- a/src/Ametrin.Optional.csproj +++ b/src/Ametrin.Optional.csproj @@ -1,7 +1,7 @@  - net8.0;net9.0 + net9.0 enable true true diff --git a/src/Extensions/DictionaryExtensions.cs b/src/Extensions/DictionaryExtensions.cs index 34150bf..ea9592b 100644 --- a/src/Extensions/DictionaryExtensions.cs +++ b/src/Extensions/DictionaryExtensions.cs @@ -7,7 +7,6 @@ public static class DictionaryExtensions public static Option TryGetValue(this IReadOnlyDictionary dictionary, TKey key) where TKey : notnull => dictionary.TryGetValue(key, out var result) ? result : default(Option); -#if NET9_0_OR_GREATER public static Option TryGetValue(this Dictionary.AlternateLookup lookup, TAlternate key) where TKey : notnull where TAlternate : notnull, allows ref struct @@ -17,5 +16,4 @@ public static Option TryGetValue(this FrozenDi where TKey : notnull where TAlternate : notnull, allows ref struct => lookup.TryGetValue(key, out var result) ? result : default(Option); -#endif } diff --git a/src/Operations/Or.cs b/src/Operations/Or.cs index fe14962..61e3931 100644 --- a/src/Operations/Or.cs +++ b/src/Operations/Or.cs @@ -2,9 +2,7 @@ namespace Ametrin.Optional; partial struct Option { -#if NET9_0_OR_GREATER [OverloadResolutionPriority(1)] // to allow 'Or(default)' which would normally be ambigious -#endif public TValue Or(TValue other) => _hasValue ? _value : other; public TValue Or(Func factory) => _hasValue ? _value! : factory(); public TValue OrThrow() => _hasValue ? _value : throw new NullReferenceException("Option is Error state"); @@ -12,9 +10,7 @@ partial struct Option partial struct Result { -#if NET9_0_OR_GREATER [OverloadResolutionPriority(1)] -#endif public TValue Or(TValue other) => _hasValue ? _value : other; public TValue Or(Func factory) => _hasValue ? _value : factory(_error); public TValue OrThrow() => _hasValue ? _value : throw new NullReferenceException("Result is Error state", _error); @@ -22,9 +18,7 @@ partial struct Result partial struct Result { -#if NET9_0_OR_GREATER [OverloadResolutionPriority(1)] -#endif public TValue Or(TValue other) => _hasValue ? _value! : other; public TValue Or(Func factory) => _hasValue ? _value! : factory(_error); public TValue OrThrow() => _hasValue ? _value! : throw new NullReferenceException($"Result is Error state: {_error}");