diff --git a/appveyor.yml b/appveyor.yml index f742bab..4335e77 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -110,7 +110,6 @@ deploy: api_key: secure: H9AFeC6uNE88rUiZxmDQNt50bhQ0ilMCua/X9s1++dNB0wMHWrKY8xjfM/M2xFja on: - branch: master configuration: Release APPVEYOR_REPO_TAG: true # GitHub @@ -124,6 +123,5 @@ deploy: prerelease: false force_update: true on: - branch: master configuration: Release APPVEYOR_REPO_TAG: true \ No newline at end of file diff --git a/src/Here/Either/Either.Constructor.cs b/src/Here/Either/Either.Constructor.cs index aa0eb91..0576f81 100644 --- a/src/Here/Either/Either.Constructor.cs +++ b/src/Here/Either/Either.Constructor.cs @@ -20,7 +20,7 @@ public static class Either /// An . /// If the is null. [PublicAPI, Pure] - public static Either Left([NotNull] in TLeft value) + public static Either Left([NotNull] TLeft value) { return Either.Left(value); } @@ -34,7 +34,7 @@ public static Either Left([NotNull] in TLeft value /// An . /// If the is null. [PublicAPI, Pure] - public static Either Left([NotNull] in TLeft? nullable) + public static Either Left([NotNull] TLeft? nullable) where TLeft : struct { if (nullable == null) @@ -65,7 +65,7 @@ public static Either ToEither([NotNull] this TLeft /// An . /// If the is null. [PublicAPI, Pure] - public static Either ToEither([NotNull] in this TLeft? nullable) + public static Either ToEither([NotNull] this TLeft? nullable) where TLeft : struct { return Left(nullable); @@ -79,7 +79,7 @@ public static Either ToEither([NotNull] in this TL /// An . /// If the is null. [PublicAPI, Pure] - public static EitherLeft Left([NotNull] in TLeft value) + public static EitherLeft Left([NotNull] TLeft value) { return new EitherLeft(value); } @@ -92,7 +92,7 @@ public static EitherLeft Left([NotNull] in TLeft value) /// An . /// If the is null. [PublicAPI, Pure] - public static EitherLeft Left([NotNull] in TLeft? nullable) + public static EitherLeft Left([NotNull] TLeft? nullable) where TLeft : struct { if (nullable == null) @@ -113,7 +113,7 @@ public static EitherLeft Left([NotNull] in TLeft? nullable) /// An . /// If the is null. [PublicAPI, Pure] - public static Either Right([NotNull] in TRight value) + public static Either Right([NotNull] TRight value) { return Either.Right(value); } @@ -127,7 +127,7 @@ public static Either Right([NotNull] in TRight val /// An . /// If the is null. [PublicAPI, Pure] - public static Either Right([NotNull] in TRight? nullable) + public static Either Right([NotNull] TRight? nullable) where TRight : struct { if (nullable == null) @@ -158,7 +158,7 @@ public static Either ToEither([NotNull] this TRigh /// An . /// If the is null. [PublicAPI, Pure] - public static Either ToEither([NotNull] in this TRight? nullable) + public static Either ToEither([NotNull] this TRight? nullable) where TRight : struct { return Right(nullable); @@ -172,7 +172,7 @@ public static Either ToEither([NotNull] in this TR /// An . /// If the is null. [PublicAPI, Pure] - public static EitherRight Right([NotNull] in TRight value) + public static EitherRight Right([NotNull] TRight value) { return new EitherRight(value); } @@ -185,7 +185,7 @@ public static EitherRight Right([NotNull] in TRight value) /// An . /// If the is null. [PublicAPI, Pure] - public static EitherRight Right([NotNull] in TRight? nullable) + public static EitherRight Right([NotNull] TRight? nullable) where TRight : struct { if (nullable == null) @@ -209,7 +209,7 @@ public static EitherRight Right([NotNull] in TRight? nullable) /// An . /// If the is null. [PublicAPI, Pure] - public static Either ToEither([CanBeNull] this TRight value, [NotNull] in TLeft defaultLeftValue) + public static Either ToEither([CanBeNull] this TRight value, [NotNull] TLeft defaultLeftValue) where TRight : class { Throw.IfArgumentNull(defaultLeftValue, nameof(defaultLeftValue)); @@ -232,7 +232,7 @@ public static Either ToEither([CanBeNull] this TRi /// If the is null. /// If the value returned by the is null. [PublicAPI, Pure] - public static Either ToEither([CanBeNull] this TRight value, [NotNull, InstantHandle] in Func leftValueFactory) + public static Either ToEither([CanBeNull] this TRight value, [NotNull, InstantHandle] Func leftValueFactory) where TRight : class { Throw.IfArgumentNull(leftValueFactory, nameof(leftValueFactory)); @@ -254,7 +254,7 @@ public static Either ToEither([CanBeNull] this TRi /// An . /// If the is null. [PublicAPI, Pure] - public static Either ToEither([CanBeNull] in this TRight? nullable, [NotNull] in TLeft defaultLeftValue) + public static Either ToEither([CanBeNull] this TRight? nullable, [NotNull] TLeft defaultLeftValue) where TRight : struct { Throw.IfArgumentNull(defaultLeftValue, nameof(defaultLeftValue)); @@ -277,7 +277,7 @@ public static Either ToEither([CanBeNull] in this /// If the is null. /// If the value returned by the is null. [PublicAPI, Pure] - public static Either ToEither([CanBeNull] in this TRight? nullable, [NotNull, InstantHandle] in Func leftValueFactory) + public static Either ToEither([CanBeNull] this TRight? nullable, [NotNull, InstantHandle] Func leftValueFactory) where TRight : struct { Throw.IfArgumentNull(leftValueFactory, nameof(leftValueFactory)); diff --git a/src/Here/Either/Either.Operations.cs b/src/Here/Either/Either.Operations.cs index b9d7a85..3bf58b7 100644 --- a/src/Here/Either/Either.Operations.cs +++ b/src/Here/Either/Either.Operations.cs @@ -25,9 +25,9 @@ public partial struct Either /// If this is in state without providing a action. [PublicAPI, Pure] public Unit Match( - [NotNull, InstantHandle] in Action onRight, - [NotNull, InstantHandle] in Action onLeft, - [CanBeNull, InstantHandle] in Action none = null) + [NotNull, InstantHandle] Action onRight, + [NotNull, InstantHandle] Action onLeft, + [CanBeNull, InstantHandle] Action none = null) { Throw.IfArgumentNull(onRight, nameof(onRight)); Throw.IfArgumentNull(onLeft, nameof(onLeft)); @@ -64,9 +64,9 @@ public Unit Match( /// If this is in state without providing a action. [PublicAPI, CanBeNull, Pure] public TOut MatchNullable( - [NotNull, InstantHandle] in Func onRight, - [NotNull, InstantHandle] in Func onLeft, - [CanBeNull, InstantHandle] in Func none = null) + [NotNull, InstantHandle] Func onRight, + [NotNull, InstantHandle] Func onLeft, + [CanBeNull, InstantHandle] Func none = null) { Throw.IfArgumentNull(onRight, nameof(onRight)); Throw.IfArgumentNull(onLeft, nameof(onLeft)); @@ -99,9 +99,9 @@ public TOut MatchNullable( /// If the result of the match is null. [PublicAPI, NotNull, Pure] public TOut Match( - [NotNull, InstantHandle] in Func onRight, - [NotNull, InstantHandle] in Func onLeft, - [CanBeNull, InstantHandle] in Func none = null) + [NotNull, InstantHandle] Func onRight, + [NotNull, InstantHandle] Func onLeft, + [CanBeNull, InstantHandle] Func none = null) { TOut result = MatchNullable(onRight, onLeft, none); return Throw.IfResultNull(result); @@ -369,7 +369,7 @@ public TState BiFold( /// The result of the applied treatment. /// If the is null. [PublicAPI] - public Unit IfLeft([NotNull, InstantHandle] in Action onLeft) + public Unit IfLeft([NotNull, InstantHandle] Action onLeft) { return Match(DoNothing, onLeft, DoNothing); } @@ -384,7 +384,7 @@ public Unit IfLeft([NotNull, InstantHandle] in Action onLeft) #if SUPPORTS_AGGRESSIVE_INLINING [MethodImpl(MethodImplOptions.AggressiveInlining)] #endif - public Unit IfFailure([NotNull, InstantHandle] in Action onFailure) + public Unit IfFailure([NotNull, InstantHandle] Action onFailure) { return IfLeft(onFailure); } @@ -501,7 +501,7 @@ public TOut IfLeft( /// This . /// If the is null. [PublicAPI] - public Either OnLeft([NotNull, InstantHandle] in Action onLeft) + public Either OnLeft([NotNull, InstantHandle] Action onLeft) { Throw.IfArgumentNull(onLeft, nameof(onLeft)); @@ -520,7 +520,7 @@ public Either OnLeft([NotNull, InstantHandle] in Action on #if SUPPORTS_AGGRESSIVE_INLINING [MethodImpl(MethodImplOptions.AggressiveInlining)] #endif - public Either OnFailure([NotNull, InstantHandle] in Action onFailure) + public Either OnFailure([NotNull, InstantHandle] Action onFailure) { return OnLeft(onFailure); } @@ -536,7 +536,7 @@ public Either OnFailure([NotNull, InstantHandle] in Action /// A . /// If the is null. [PublicAPI] - public Unit IfRight([NotNull, InstantHandle] in Action onRight) + public Unit IfRight([NotNull, InstantHandle] Action onRight) { return Match(onRight, DoNothing, DoNothing); } @@ -551,7 +551,7 @@ public Unit IfRight([NotNull, InstantHandle] in Action onRight) #if SUPPORTS_AGGRESSIVE_INLINING [MethodImpl(MethodImplOptions.AggressiveInlining)] #endif - public Unit IfSuccess([NotNull, InstantHandle] in Action onSuccess) + public Unit IfSuccess([NotNull, InstantHandle] Action onSuccess) { return IfRight(onSuccess); } @@ -668,7 +668,7 @@ public TOut IfRight( /// This . /// If the is null. [PublicAPI] - public Either OnRight([NotNull, InstantHandle] in Action onRight) + public Either OnRight([NotNull, InstantHandle] Action onRight) { Throw.IfArgumentNull(onRight, nameof(onRight)); @@ -687,7 +687,7 @@ public Either OnRight([NotNull, InstantHandle] in Action #if SUPPORTS_AGGRESSIVE_INLINING [MethodImpl(MethodImplOptions.AggressiveInlining)] #endif - public Either OnSuccess([NotNull, InstantHandle] in Action onSuccess) + public Either OnSuccess([NotNull, InstantHandle] Action onSuccess) { return OnRight(onSuccess); } @@ -707,8 +707,8 @@ public Either OnSuccess([NotNull, InstantHandle] in ActionIf the is null. [PublicAPI] public Either OnRightOrLeft( - [NotNull, InstantHandle] in Action onRight, - [NotNull, InstantHandle] in Action onLeft) + [NotNull, InstantHandle] Action onRight, + [NotNull, InstantHandle] Action onLeft) { Throw.IfArgumentNull(onRight, nameof(onRight)); Throw.IfArgumentNull(onLeft, nameof(onLeft)); @@ -739,8 +739,8 @@ public Either OnRightOrLeft( [MethodImpl(MethodImplOptions.AggressiveInlining)] #endif public Either OnSuccessOrFailure( - [NotNull, InstantHandle] in Action onSuccess, - [NotNull, InstantHandle] in Action onFailure) + [NotNull, InstantHandle] Action onSuccess, + [NotNull, InstantHandle] Action onFailure) { return OnRightOrLeft(onSuccess, onFailure); } @@ -768,7 +768,7 @@ public TRight RightOrDefault() /// The either right value, otherwise the provided default value. /// If the is null. [PublicAPI, Pure, NotNull] - public TRight RightOr([NotNull] in TRight defaultValue) + public TRight RightOr([NotNull] TRight defaultValue) { Throw.IfArgumentNull(defaultValue, nameof(defaultValue)); @@ -790,7 +790,7 @@ public TRight RightOr([NotNull] in TRight defaultValue) /// If the is null. /// If the result of the function is null. [PublicAPI, Pure, NotNull] - public TRight RightOr([NotNull, InstantHandle] in Func valueFactory) + public TRight RightOr([NotNull, InstantHandle] Func valueFactory) { Throw.IfArgumentNull(valueFactory, nameof(valueFactory)); @@ -823,7 +823,7 @@ public TLeft LeftOrDefault() /// The either left value, otherwise the provided default value. /// If the is null. [PublicAPI, Pure, NotNull] - public TLeft LeftOr([NotNull] in TLeft defaultValue) + public TLeft LeftOr([NotNull] TLeft defaultValue) { Throw.IfArgumentNull(defaultValue, nameof(defaultValue)); @@ -845,7 +845,7 @@ public TLeft LeftOr([NotNull] in TLeft defaultValue) /// If the is null. /// If the result of the function is null. [PublicAPI, Pure, NotNull] - public TLeft LeftOr([NotNull, InstantHandle] in Func valueFactory) + public TLeft LeftOr([NotNull, InstantHandle] Func valueFactory) { Throw.IfArgumentNull(valueFactory, nameof(valueFactory)); diff --git a/src/Here/Either/Either.cs b/src/Here/Either/Either.cs index 912db70..b20679c 100644 --- a/src/Here/Either/Either.cs +++ b/src/Here/Either/Either.cs @@ -16,7 +16,7 @@ namespace Here /// Type of the value embedded as right value in the . [PublicAPI] [DebuggerDisplay("{\"Is\" + " + nameof(_state) + " + (" + nameof(IsNone) + " ? System.String.Empty : \", Value = \" + (" + nameof(IsLeft) + " ?" + nameof(_left) + ".ToString() : " + nameof(_right) + ".ToString()))}")] - public readonly partial struct Either : + public partial struct Either : IEither, IEquatable, IEquatable>, @@ -102,14 +102,14 @@ public TRight RightValue /// /// Left value. /// If the is null. - private Either([NotNull] in TLeft value) + private Either([NotNull] TLeft value) { if (value == null) throw new ArgumentNullException(nameof(value), "Cannot initialize an Either in Left state with a null value."); _state = EitherStates.Left; _left = value; - _right = default; + _right = default(TRight); } /// @@ -117,13 +117,13 @@ private Either([NotNull] in TLeft value) /// /// Right value. /// If the is null. - private Either([NotNull] in TRight value) + private Either([NotNull] TRight value) { if (value == null) throw new ArgumentNullException(nameof(value), "Cannot initialize an Either in Right with a null value."); _state = EitherStates.Right; - _left = default; + _left = default(TLeft); _right = value; } @@ -134,7 +134,7 @@ private Either([NotNull] in TRight value) /// An . /// If the is null. [Pure] - internal static Either Left([NotNull] in TLeft value) + internal static Either Left([NotNull] TLeft value) { return new Either(value); } @@ -146,7 +146,7 @@ internal static Either Left([NotNull] in TLeft value) /// An . /// If the is null. [Pure] - internal static Either Right([NotNull] in TRight value) + internal static Either Right([NotNull] TRight value) { return new Either(value); } @@ -158,7 +158,7 @@ internal static Either Right([NotNull] in TRight value) /// The left value. /// If the either is casted to a left value while not being in state. [PublicAPI, Pure] - public static explicit operator TLeft(in Either either) + public static explicit operator TLeft(Either either) { return either.IsLeft ? either._left @@ -172,7 +172,7 @@ public static explicit operator TLeft(in Either either) /// The right value. /// If the either is casted to a left value while not being in state. [PublicAPI, Pure] - public static explicit operator TRight(in Either either) + public static explicit operator TRight(Either either) { return either.IsRight ? either._right @@ -236,7 +236,7 @@ public override bool Equals(object obj) /// Second to compare. /// True if both are equal, otherwise false. [Pure] - internal static bool AreEqual(in Either either1, in Either either2) + internal static bool AreEqual(Either either1, Either either2) { if (either1.IsLeft && either2.IsLeft) return EqualityComparer.Default.Equals(either1._left, either2._left); @@ -256,7 +256,7 @@ internal static bool AreEqual(in Either either1, in EitherFirst to compare. /// Second to compare. /// True if both are equal, otherwise false. - public static bool operator ==(in Either either1, in Either either2) + public static bool operator ==(Either either1, Either either2) { return AreEqual(either1, either2); } @@ -267,7 +267,7 @@ internal static bool AreEqual(in Either either1, in EitherFirst to compare. /// Second to compare. /// True if both are not equal, otherwise false. - public static bool operator !=(in Either either1, in Either either2) + public static bool operator !=(Either either1, Either either2) { return !(either1 == either2); } @@ -278,7 +278,7 @@ internal static bool AreEqual(in Either either1, in Either to compare. /// to compare. /// True if and are equal, otherwise false. - public static bool operator ==(in Either either, in EitherLeft eitherLeft) + public static bool operator ==(Either either, EitherLeft eitherLeft) { return either.Equals(eitherLeft); } @@ -289,7 +289,7 @@ internal static bool AreEqual(in Either either1, in Either to compare. /// to compare. /// True if and are not equal, otherwise false. - public static bool operator !=(in Either either, in EitherLeft eitherLeft) + public static bool operator !=(Either either, EitherLeft eitherLeft) { return !(either == eitherLeft); } @@ -300,7 +300,7 @@ internal static bool AreEqual(in Either either1, in Either to compare. /// to compare. /// True if and are equal, otherwise false. - public static bool operator ==(in EitherLeft eitherLeft, in Either either) + public static bool operator ==(EitherLeft eitherLeft, Either either) { return either == eitherLeft; } @@ -311,7 +311,7 @@ internal static bool AreEqual(in Either either1, in Either to compare. /// to compare. /// True if and are not equal, otherwise false. - public static bool operator !=(in EitherLeft eitherLeft, in Either either) + public static bool operator !=(EitherLeft eitherLeft, Either either) { return !(either == eitherLeft); } @@ -322,7 +322,7 @@ internal static bool AreEqual(in Either either1, in Either to compare. /// to compare. /// True if and are equal, otherwise false. - public static bool operator ==(in Either either, in EitherRight eitherRight) + public static bool operator ==(Either either, EitherRight eitherRight) { return either.Equals(eitherRight); } @@ -333,7 +333,7 @@ internal static bool AreEqual(in Either either1, in Either to compare. /// to compare. /// True if and are not equal, otherwise false. - public static bool operator !=(in Either either, in EitherRight eitherRight) + public static bool operator !=(Either either, EitherRight eitherRight) { return !(either == eitherRight); } @@ -344,7 +344,7 @@ internal static bool AreEqual(in Either either1, in Either to compare. /// to compare. /// True if and are equal, otherwise false. - public static bool operator ==(in EitherRight eitherRight, in Either either) + public static bool operator ==(EitherRight eitherRight, Either either) { return either == eitherRight; } @@ -355,7 +355,7 @@ internal static bool AreEqual(in Either either1, in Either to compare. /// to compare. /// True if and are not equal, otherwise false. - public static bool operator !=(in EitherRight eitherRight, in Either either) + public static bool operator !=(EitherRight eitherRight, Either either) { return !(either == eitherRight); } @@ -367,7 +367,7 @@ internal static bool AreEqual(in Either either1, in EitherValue to compare. /// True if the is in state /// and its value is equals to the , otherwise false. - public static bool operator ==(in Either either, in TRight rightValue) + public static bool operator ==(Either either, TRight rightValue) { return either.Equals(rightValue); } @@ -379,7 +379,7 @@ internal static bool AreEqual(in Either either1, in EitherValue to compare. /// True if the is not in state /// with its value equals to the , otherwise false. - public static bool operator !=(in Either either, in TRight rightValue) + public static bool operator !=(Either either, TRight rightValue) { return !(either == rightValue); } @@ -391,7 +391,7 @@ internal static bool AreEqual(in Either either1, in EitherFirst to compare. /// True if the is in state /// and its value is equals to the , otherwise false. - public static bool operator ==(in TRight rightValue, in Either either) + public static bool operator ==(TRight rightValue, Either either) { return either == rightValue; } @@ -403,7 +403,7 @@ internal static bool AreEqual(in Either either1, in EitherFirst to compare. /// True if the is not in state /// with its value equals to the , otherwise false. - public static bool operator !=(in TRight rightValue, in Either either) + public static bool operator !=(TRight rightValue, Either either) { return !(either == rightValue); } @@ -415,7 +415,7 @@ internal static bool AreEqual(in Either either1, in EitherValue to compare. /// True if the is in state /// and its value is equals to the , otherwise false. - public static bool operator ==(in Either either, in TLeft leftValue) + public static bool operator ==(Either either, TLeft leftValue) { return either.Equals(leftValue); } @@ -427,7 +427,7 @@ internal static bool AreEqual(in Either either1, in EitherValue to compare. /// True if the is not in state /// with its value equals to the , otherwise false. - public static bool operator !=(in Either either, in TLeft leftValue) + public static bool operator !=(Either either, TLeft leftValue) { return !(either == leftValue); } @@ -439,7 +439,7 @@ internal static bool AreEqual(in Either either1, in EitherFirst to compare. /// True if the is in state /// and its value is equals to the , otherwise false. - public static bool operator ==(in TLeft leftValue, in Either either) + public static bool operator ==(TLeft leftValue, Either either) { return either == leftValue; } @@ -451,7 +451,7 @@ internal static bool AreEqual(in Either either1, in EitherFirst to compare. /// True if the is not in state /// with its value equals to the , otherwise false. - public static bool operator !=(in TLeft leftValue, in Either either) + public static bool operator !=(TLeft leftValue, Either either) { return !(either == leftValue); } @@ -533,7 +533,7 @@ public int CompareTo(Either other) /// Second to compare. /// An integer that indicates the relative order of compared objects. [Pure] - internal static int Compare(in Either either1, in Either either2) + internal static int Compare(Either either1, Either either2) { if (either1.IsNone) return either2.IsNone ? 0 : -1; @@ -559,7 +559,7 @@ internal static int Compare(in Either either1, in EitherThe first to compare. /// The second to compare. /// The comparison result. - public static bool operator <(in Either either1, in Either either2) + public static bool operator <(Either either1, Either either2) { return either1.CompareTo(either2) < 0; } @@ -570,7 +570,7 @@ internal static int Compare(in Either either1, in EitherThe first to compare. /// The second to compare. /// The comparison result. - public static bool operator <=(in Either either1, in Either either2) + public static bool operator <=(Either either1, Either either2) { return either1.CompareTo(either2) <= 0; } @@ -581,7 +581,7 @@ internal static int Compare(in Either either1, in EitherThe first to compare. /// The second to compare. /// The comparison result. - public static bool operator >(in Either either1, in Either either2) + public static bool operator >(Either either1, Either either2) { return either1.CompareTo(either2) > 0; } @@ -592,7 +592,7 @@ internal static int Compare(in Either either1, in EitherThe first to compare. /// The second to compare. /// The comparison result. - public static bool operator >=(in Either either1, in Either either2) + public static bool operator >=(Either either1, Either either2) { return either1.CompareTo(either2) >= 0; } @@ -607,7 +607,7 @@ internal static int Compare(in Either either1, in Either to compare. /// to compare. /// The comparison result. - public static bool operator <(in Either either, in EitherLeft eitherLeft) + public static bool operator <(Either either, EitherLeft eitherLeft) { return Compare(either, eitherLeft) < 0; } @@ -618,7 +618,7 @@ internal static int Compare(in Either either1, in Either to compare. /// to compare. /// The comparison result. - public static bool operator <=(in Either either, in EitherLeft eitherLeft) + public static bool operator <=(Either either, EitherLeft eitherLeft) { return Compare(either, eitherLeft) <= 0; } @@ -629,7 +629,7 @@ internal static int Compare(in Either either1, in Either to compare. /// to compare. /// The comparison result. - public static bool operator >(in Either either, in EitherLeft eitherLeft) + public static bool operator >(Either either, EitherLeft eitherLeft) { return Compare(either, eitherLeft) > 0; } @@ -640,7 +640,7 @@ internal static int Compare(in Either either1, in Either to compare. /// to compare. /// The comparison result. - public static bool operator >=(in Either either, in EitherLeft eitherLeft) + public static bool operator >=(Either either, EitherLeft eitherLeft) { return Compare(either, eitherLeft) >= 0; } @@ -651,7 +651,7 @@ internal static int Compare(in Either either1, in Either to compare. /// to compare. /// The comparison result. - public static bool operator <(in EitherLeft eitherLeft, in Either either) + public static bool operator <(EitherLeft eitherLeft, Either either) { return Compare(eitherLeft, either) < 0; } @@ -662,7 +662,7 @@ internal static int Compare(in Either either1, in Either to compare. /// to compare. /// The comparison result. - public static bool operator <=(in EitherLeft eitherLeft, in Either either) + public static bool operator <=(EitherLeft eitherLeft, Either either) { return Compare(eitherLeft, either) <= 0; } @@ -673,7 +673,7 @@ internal static int Compare(in Either either1, in Either to compare. /// to compare. /// The comparison result. - public static bool operator >(in EitherLeft eitherLeft, in Either either) + public static bool operator >(EitherLeft eitherLeft, Either either) { return Compare(eitherLeft, either) > 0; } @@ -684,7 +684,7 @@ internal static int Compare(in Either either1, in Either to compare. /// to compare. /// The comparison result. - public static bool operator >=(in EitherLeft eitherLeft, in Either either) + public static bool operator >=(EitherLeft eitherLeft, Either either) { return Compare(eitherLeft, either) >= 0; } @@ -699,7 +699,7 @@ internal static int Compare(in Either either1, in Either to compare. /// to compare. /// The comparison result. - public static bool operator <(in Either either, in EitherRight eitherRight) + public static bool operator <(Either either, EitherRight eitherRight) { return Compare(either, eitherRight) < 0; } @@ -710,7 +710,7 @@ internal static int Compare(in Either either1, in Either to compare. /// to compare. /// The comparison result. - public static bool operator <=(in Either either, in EitherRight eitherRight) + public static bool operator <=(Either either, EitherRight eitherRight) { return Compare(either, eitherRight) <= 0; } @@ -721,7 +721,7 @@ internal static int Compare(in Either either1, in Either to compare. /// to compare. /// The comparison result. - public static bool operator >(in Either either, in EitherRight eitherRight) + public static bool operator >(Either either, EitherRight eitherRight) { return Compare(either, eitherRight) > 0; } @@ -732,7 +732,7 @@ internal static int Compare(in Either either1, in Either to compare. /// to compare. /// The comparison result. - public static bool operator >=(in Either either, in EitherRight eitherRight) + public static bool operator >=(Either either, EitherRight eitherRight) { return Compare(either, eitherRight) >= 0; } @@ -743,7 +743,7 @@ internal static int Compare(in Either either1, in Either to compare. /// to compare. /// The comparison result. - public static bool operator <(in EitherRight eitherRight, in Either either) + public static bool operator <(EitherRight eitherRight, Either either) { return Compare(eitherRight, either) < 0; } @@ -754,7 +754,7 @@ internal static int Compare(in Either either1, in Either to compare. /// to compare. /// The comparison result. - public static bool operator <=(in EitherRight eitherRight, in Either either) + public static bool operator <=(EitherRight eitherRight, Either either) { return Compare(eitherRight, either) <= 0; } @@ -765,7 +765,7 @@ internal static int Compare(in Either either1, in Either to compare. /// to compare. /// The comparison result. - public static bool operator >(in EitherRight eitherRight, in Either either) + public static bool operator >(EitherRight eitherRight, Either either) { return Compare(eitherRight, either) > 0; } @@ -776,7 +776,7 @@ internal static int Compare(in Either either1, in Either to compare. /// to compare. /// The comparison result. - public static bool operator >=(in EitherRight eitherRight, in Either either) + public static bool operator >=(EitherRight eitherRight, Either either) { return Compare(eitherRight, either) >= 0; } diff --git a/src/Here/Either/EitherHelpers.cs b/src/Here/Either/EitherHelpers.cs index 196fe99..12f6c57 100644 --- a/src/Here/Either/EitherHelpers.cs +++ b/src/Here/Either/EitherHelpers.cs @@ -15,7 +15,7 @@ public static class EitherHelpers /// Second to compare. /// True if both are equal, otherwise false. [PublicAPI, Pure] - public static bool AreEqual(in Either either1, in Either either2) + public static bool AreEqual(Either either1, Either either2) { return Either.AreEqual(either1, either2); } @@ -27,7 +27,7 @@ public static bool AreEqual(in Either either1, in /// Second to compare. /// True if both are equal, otherwise false. [PublicAPI, Pure] - public static bool AreEqual(in EitherLeft eitherLeft1, in EitherLeft eitherLeft2) + public static bool AreEqual(EitherLeft eitherLeft1, EitherLeft eitherLeft2) { return eitherLeft1.Equals(eitherLeft2); } @@ -39,7 +39,7 @@ public static bool AreEqual(in EitherLeft eitherLeft1, in EitherLe /// Second to compare. /// True if both are equal, otherwise false. [PublicAPI, Pure] - public static bool AreEqual(in EitherRight eitherRight1, in EitherRight eitherRight2) + public static bool AreEqual(EitherRight eitherRight1, EitherRight eitherRight2) { return eitherRight1.Equals(eitherRight2); } @@ -52,7 +52,7 @@ public static bool AreEqual(in EitherRight eitherRight1, in Eith /// Second to compare. /// An integer that indicates the relative order of compared objects. [PublicAPI, Pure] - public static int Compare(in Either either1, in Either either2) + public static int Compare(Either either1, Either either2) { return Either.Compare(either1, either2); } @@ -65,7 +65,7 @@ public static int Compare(in Either either1, in Ei /// Second to compare. /// An integer that indicates the relative order of compared objects. [PublicAPI, Pure] - public static int Compare(in EitherLeft eitherLeft1, in EitherLeft eitherLeft2) + public static int Compare(EitherLeft eitherLeft1, EitherLeft eitherLeft2) { return eitherLeft1.CompareTo(eitherLeft2); } @@ -78,7 +78,7 @@ public static int Compare(in EitherLeft eitherLeft1, in EitherLeft /// Second to compare. /// An integer that indicates the relative order of compared objects. [PublicAPI, Pure] - public static int Compare(in EitherRight eitherRight1, in EitherRight eitherRight2) + public static int Compare(EitherRight eitherRight1, EitherRight eitherRight2) { return eitherRight1.CompareTo(eitherRight2); } diff --git a/src/Here/Either/EitherLeft.cs b/src/Here/Either/EitherLeft.cs index 47c8e95..f826470 100644 --- a/src/Here/Either/EitherLeft.cs +++ b/src/Here/Either/EitherLeft.cs @@ -12,7 +12,7 @@ namespace Here /// Type of the value embedded as left value in the . [PublicAPI] [DebuggerDisplay("IsLeft, Value = {" + nameof(Left) + "}")] - public readonly struct EitherLeft : + public struct EitherLeft : IEither, IEquatable, IEquatable>, @@ -72,7 +72,7 @@ public override bool Equals(object obj) /// First to compare. /// Second to compare. /// True if both are equal, otherwise false. - public static bool operator ==(in EitherLeft either1, in EitherLeft either2) + public static bool operator ==(EitherLeft either1, EitherLeft either2) { return either1.Equals(either2); } @@ -83,7 +83,7 @@ public override bool Equals(object obj) /// First to compare. /// Second to compare. /// True if both are not equal, otherwise false. - public static bool operator !=(in EitherLeft either1, in EitherLeft either2) + public static bool operator !=(EitherLeft either1, EitherLeft either2) { return !(either1 == either2); } @@ -127,7 +127,7 @@ public int CompareTo(EitherLeft other) /// The first to compare. /// The second to compare. /// The comparison result. - public static bool operator <(in EitherLeft left, in EitherLeft right) + public static bool operator <(EitherLeft left, EitherLeft right) { return left.CompareTo(right) < 0; } @@ -138,7 +138,7 @@ public int CompareTo(EitherLeft other) /// The first to compare. /// The second to compare. /// The comparison result. - public static bool operator <=(in EitherLeft left, in EitherLeft right) + public static bool operator <=(EitherLeft left, EitherLeft right) { return left.CompareTo(right) <= 0; } @@ -149,7 +149,7 @@ public int CompareTo(EitherLeft other) /// The first to compare. /// The second to compare. /// The comparison result. - public static bool operator >(in EitherLeft left, in EitherLeft right) + public static bool operator >(EitherLeft left, EitherLeft right) { return left.CompareTo(right) > 0; } @@ -160,7 +160,7 @@ public int CompareTo(EitherLeft other) /// The first to compare. /// The second to compare. /// The comparison result. - public static bool operator >=(in EitherLeft left, in EitherLeft right) + public static bool operator >=(EitherLeft left, EitherLeft right) { return left.CompareTo(right) >= 0; } diff --git a/src/Here/Either/EitherRight.cs b/src/Here/Either/EitherRight.cs index 52ba422..2d4e964 100644 --- a/src/Here/Either/EitherRight.cs +++ b/src/Here/Either/EitherRight.cs @@ -12,7 +12,7 @@ namespace Here /// Type of the value embedded as right value in the . [PublicAPI] [DebuggerDisplay("IsRight, Value = {" + nameof(Value) + "}")] - public readonly struct EitherRight : + public struct EitherRight : IEither, IEquatable, IEquatable>, @@ -75,7 +75,7 @@ public override bool Equals(object obj) /// First to compare. /// Second to compare. /// True if both are equal, otherwise false. - public static bool operator ==(in EitherRight either1, in EitherRight either2) + public static bool operator ==(EitherRight either1, EitherRight either2) { return either1.Equals(either2); } @@ -86,7 +86,7 @@ public override bool Equals(object obj) /// First to compare. /// Second to compare. /// True if both are not equal, otherwise false. - public static bool operator !=(in EitherRight either1, in EitherRight either2) + public static bool operator !=(EitherRight either1, EitherRight either2) { return !(either1 == either2); } @@ -130,7 +130,7 @@ public int CompareTo(EitherRight other) /// The first to compare. /// The second to compare. /// The comparison result. - public static bool operator <(in EitherRight left, in EitherRight right) + public static bool operator <(EitherRight left, EitherRight right) { return left.CompareTo(right) < 0; } @@ -141,7 +141,7 @@ public int CompareTo(EitherRight other) /// The first to compare. /// The second to compare. /// The comparison result. - public static bool operator <=(in EitherRight left, in EitherRight right) + public static bool operator <=(EitherRight left, EitherRight right) { return left.CompareTo(right) <= 0; } @@ -152,7 +152,7 @@ public int CompareTo(EitherRight other) /// The first to compare. /// The second to compare. /// The comparison result. - public static bool operator >(in EitherRight left, in EitherRight right) + public static bool operator >(EitherRight left, EitherRight right) { return left.CompareTo(right) > 0; } @@ -163,7 +163,7 @@ public int CompareTo(EitherRight other) /// The first to compare. /// The second to compare. /// The comparison result. - public static bool operator >=(in EitherRight left, in EitherRight right) + public static bool operator >=(EitherRight left, EitherRight right) { return left.CompareTo(right) >= 0; } diff --git a/src/Here/Either/Extensions/EitherLinqExtensions.cs b/src/Here/Either/Extensions/EitherLinqExtensions.cs index 94473de..0466137 100644 --- a/src/Here/Either/Extensions/EitherLinqExtensions.cs +++ b/src/Here/Either/Extensions/EitherLinqExtensions.cs @@ -20,7 +20,7 @@ public static class EitherLinqExtensions /// on which performing the check. /// True if this has a right value, otherwise false. [PublicAPI, Pure] - public static bool Any(in this Either either) + public static bool Any(this Either either) { return either.IsRight; } @@ -35,7 +35,7 @@ public static bool Any(in this Either either) /// True if this has a right value and matches the predicate, otherwise false. /// If the is null. [PublicAPI, Pure] - public static bool Any(in this Either either, [NotNull, InstantHandle] in Predicate predicate) + public static bool Any(this Either either, [NotNull, InstantHandle] Predicate predicate) { Throw.IfArgumentNull(predicate, nameof(predicate)); @@ -55,7 +55,7 @@ public static bool Any(in this Either either, [Not #if SUPPORTS_AGGRESSIVE_INLINING [MethodImpl(MethodImplOptions.AggressiveInlining)] #endif - public static bool All(in this Either either, [NotNull, InstantHandle] in Predicate predicate) + public static bool All(this Either either, [NotNull, InstantHandle] Predicate predicate) { return either.Any(predicate); } @@ -69,7 +69,7 @@ public static bool All(in this Either either, [Not /// Value to check equality with right value. /// True if this contains the given as right value, otherwise false. [PublicAPI, Pure] - public static bool Contains(in this Either either, [CanBeNull] in TRight value) + public static bool Contains(this Either either, [CanBeNull] TRight value) { return either.IsRight && EqualityComparer.Default.Equals(either._right, value); } @@ -88,7 +88,7 @@ public static bool Contains(in this Either either, #if SUPPORTS_AGGRESSIVE_INLINING [MethodImpl(MethodImplOptions.AggressiveInlining)] #endif - public static Either Select(in this Either either, [NotNull, InstantHandle] in Func selector) + public static Either Select(this Either either, [NotNull, InstantHandle] Func selector) { return either.Map(selector); } @@ -103,7 +103,7 @@ public static Either Select(in this /// This if it matches the , otherwise an empty . /// If the is null. [PublicAPI, Pure] - public static Either Where(in this Either either, [NotNull, InstantHandle] in Predicate predicate) + public static Either Where(this Either either, [NotNull, InstantHandle] Predicate predicate) { if (either.All(predicate)) return either; @@ -123,7 +123,7 @@ public static Either Where(in this Either(in this Either either, [NotNull, InstantHandle] in Action doAction) + public static Unit ForEach(this Either either, [NotNull, InstantHandle] Action doAction) { return either.IfRight(doAction); } @@ -146,9 +146,9 @@ public static Unit ForEach(in this Either either, #if SUPPORTS_AGGRESSIVE_INLINING [MethodImpl(MethodImplOptions.AggressiveInlining)] #endif - public static TAggregate Aggregate(in this Either either, - [NotNull] in TAggregate initialValue, - [NotNull, InstantHandle] in Func aggregator) + public static TAggregate Aggregate(this Either either, + [NotNull] TAggregate initialValue, + [NotNull, InstantHandle] Func aggregator) { return either.Fold(initialValue, aggregator); } diff --git a/src/Here/Either/Extensions/EitherOperatorsExtensions.cs b/src/Here/Either/Extensions/EitherOperatorsExtensions.cs index 6d91d2b..b072bd8 100644 --- a/src/Here/Either/Extensions/EitherOperatorsExtensions.cs +++ b/src/Here/Either/Extensions/EitherOperatorsExtensions.cs @@ -15,7 +15,7 @@ public static class EitherOperatorsExtensions /// /// to convert. /// An . - public static Option ToOption(in this Either either) + public static Option ToOption(this Either either) { if (either.IsRight) return Option.Some(either._right); @@ -31,7 +31,7 @@ public static Option ToOption(in this Either /// to convert. /// A . - public static Result ToResult(in this Either either) + public static Result ToResult(this Either either) { if (either.IsRight) return Result.Ok(); @@ -43,7 +43,7 @@ public static Result ToResult(in this Either eithe /// /// to convert. /// A . - public static Result ToResult(in this Either either) + public static Result ToResult(this Either either) { if (either.IsRight) return Result.Ok(); @@ -57,7 +57,7 @@ public static Result ToResult(in this Either either) /// /// to convert. /// A . - public static Result ToValueResult(in this Either either) + public static Result ToValueResult(this Either either) { if (either.IsRight) return Result.Ok(either._right); @@ -69,7 +69,7 @@ public static Result ToValueResult(in this Either /// to convert. /// A . - public static Result ToValueResult(in this Either either) + public static Result ToValueResult(this Either either) { if (either.IsRight) return Result.Ok(either._right); @@ -84,7 +84,7 @@ public static Result ToValueResult(in this Either to convert. /// A . /// If the either is in state. - public static CustomResult ToCustomResult(in this Either either) + public static CustomResult ToCustomResult(this Either either) { if (either.IsRight) return Result.CustomOk(); @@ -100,7 +100,7 @@ public static CustomResult ToCustomResult(in this Either to convert. /// A . /// If the either is in state. - public static Result ToValueCustomResult(in this Either either) + public static Result ToValueCustomResult(this Either either) { if (either.IsRight) return Result.Ok(either._right); diff --git a/src/Here/Here.csproj b/src/Here/Here.csproj index b31d308..b4e5af6 100644 --- a/src/Here/Here.csproj +++ b/src/Here/Here.csproj @@ -36,9 +36,9 @@ Supports Source Link true Here - ➟ Release 0.8.1 + ➟ Release 0.8.0 - General: - - Library use C# 7.2 features. + - Library use C# 7.0 features. - Change target NetStandard 1.1 to NetStandard 1.0. - Adjust some annotations of library methods. - Add early throw for parameters that should not be null. @@ -60,7 +60,7 @@ Supports Source Link - Add an implementation of Unit type. - Either: - - Add a first implementation Either monad (readonly structure). + - Add a first implementation Either monad. - Operations methods (IfLeft/IfRight/Match/Map, etc.). - Linq extensions. - Comparison helpers. @@ -76,7 +76,7 @@ Supports Source Link - 7.2 + 7.0 diff --git a/src/Here/Option/Extensions/OptionDictionaryExtensions.cs b/src/Here/Option/Extensions/OptionDictionaryExtensions.cs index c354e7d..07e2e9e 100644 --- a/src/Here/Option/Extensions/OptionDictionaryExtensions.cs +++ b/src/Here/Option/Extensions/OptionDictionaryExtensions.cs @@ -11,7 +11,7 @@ public static class OptionDictionaryExtensions { // Helper method to try get a value [Pure] - private static Option TryGetValue([NotNull] in OptionTryGetExtensions.TryGet tryGetFunc, [CanBeNull] in TKey key) + private static Option TryGetValue([NotNull] OptionTryGetExtensions.TryGet tryGetFunc, [CanBeNull] TKey key) { if (key == null) return Option.None; @@ -29,7 +29,7 @@ private static Option TryGetValue([NotNull] in OptionTryGe /// that wrap the result of the get. /// If the is null. [PublicAPI, Pure] - public static Option TryGetValue([NotNull] this IDictionary dictionary, [CanBeNull] in TKey key) + public static Option TryGetValue([NotNull] this IDictionary dictionary, [CanBeNull] TKey key) { Throw.IfArgumentNull(dictionary, nameof(dictionary)); @@ -46,7 +46,7 @@ public static Option TryGetValue([NotNull] this IDictionar /// that wrap the result of the get. /// If the is null. [PublicAPI, Pure] - public static Option TryGetValue([NotNull] this IDictionary dictionary, [CanBeNull] in TKey key) + public static Option TryGetValue([NotNull] this IDictionary dictionary, [CanBeNull] TKey key) { Throw.IfArgumentNull(dictionary, nameof(dictionary)); @@ -67,7 +67,7 @@ public static Option TryGetValue([NotNull] this IDictionar /// that wrap the result of the get. /// If the is null. [PublicAPI, Pure] - public static Option TryGetReadonlyValue([NotNull] this IReadOnlyDictionary dictionary, [CanBeNull] in TKey key) + public static Option TryGetReadonlyValue([NotNull] this IReadOnlyDictionary dictionary, [CanBeNull] TKey key) { Throw.IfArgumentNull(dictionary, nameof(dictionary)); @@ -84,7 +84,7 @@ public static Option TryGetReadonlyValue([NotNull] this IR /// that wrap the result of the get. /// If the is null. [PublicAPI, Pure] - public static Option TryGetReadonlyValue([NotNull] this IReadOnlyDictionary dictionary, [CanBeNull] in TKey key) + public static Option TryGetReadonlyValue([NotNull] this IReadOnlyDictionary dictionary, [CanBeNull] TKey key) { Throw.IfArgumentNull(dictionary, nameof(dictionary)); diff --git a/src/Here/Option/Extensions/OptionEnumerableExtensions.cs b/src/Here/Option/Extensions/OptionEnumerableExtensions.cs index 452ebfe..b94a311 100644 --- a/src/Here/Option/Extensions/OptionEnumerableExtensions.cs +++ b/src/Here/Option/Extensions/OptionEnumerableExtensions.cs @@ -33,7 +33,7 @@ public static Option FirstOrNone([NotNull] this IEnumerable enumerable) /// If the is null. /// If the is null. [PublicAPI, Pure] - public static Option FirstOrNone([NotNull] this IEnumerable enumerable, [NotNull, InstantHandle] in Predicate predicate) + public static Option FirstOrNone([NotNull] this IEnumerable enumerable, [NotNull, InstantHandle] Predicate predicate) { Throw.IfArgumentNull(enumerable, nameof(enumerable)); Throw.IfArgumentNull(predicate, nameof(predicate)); @@ -58,7 +58,7 @@ public static Option FirstOrNone([NotNull] this IEnumerable enumerable, /// If the is null. /// If the contains more than one element. [PublicAPI, Pure] - public static Option SingleOrNone([NotNull] this IEnumerable enumerable, in bool throwInvalidException = true) + public static Option SingleOrNone([NotNull] this IEnumerable enumerable, bool throwInvalidException = true) { Throw.IfArgumentNull(enumerable, nameof(enumerable)); @@ -90,7 +90,7 @@ public static Option SingleOrNone([NotNull] this IEnumerable enumerable /// If the is null. /// If the contains more than one element matching the . [PublicAPI, Pure] - public static Option SingleOrNone([NotNull] this IEnumerable enumerable, [NotNull, InstantHandle] in Predicate predicate, in bool throwInvalidException = true) + public static Option SingleOrNone([NotNull] this IEnumerable enumerable, [NotNull, InstantHandle] Predicate predicate, bool throwInvalidException = true) { Throw.IfArgumentNull(enumerable, nameof(enumerable)); Throw.IfArgumentNull(predicate, nameof(predicate)); @@ -143,12 +143,12 @@ public static Option LastOrNone([NotNull] this IEnumerable enumerable) /// If the is null. /// If the is null. [PublicAPI, Pure] - public static Option LastOrNone([NotNull] this IEnumerable enumerable, [NotNull, InstantHandle] in Predicate predicate) + public static Option LastOrNone([NotNull] this IEnumerable enumerable, [NotNull, InstantHandle] Predicate predicate) { Throw.IfArgumentNull(enumerable, nameof(enumerable)); Throw.IfArgumentNull(predicate, nameof(predicate)); - T matchedItem = default; + T matchedItem = default(T); bool match = false; foreach (var item in enumerable) @@ -288,7 +288,7 @@ public static List ToList([NotNull] this IEnumerable> enumerable /// If the is null. /// If the is null. [PublicAPI, Pure, NotNull] - public static Dictionary ToDictionary([NotNull] this IEnumerable> enumerable, [NotNull, InstantHandle] in Func keySelector) + public static Dictionary ToDictionary([NotNull] this IEnumerable> enumerable, [NotNull, InstantHandle] Func keySelector) { Throw.IfArgumentNull(enumerable, nameof(enumerable)); Throw.IfArgumentNull(keySelector, nameof(keySelector)); diff --git a/src/Here/Option/Extensions/OptionExtensions.cs b/src/Here/Option/Extensions/OptionExtensions.cs index c2bcfd5..35d673f 100644 --- a/src/Here/Option/Extensions/OptionExtensions.cs +++ b/src/Here/Option/Extensions/OptionExtensions.cs @@ -29,7 +29,7 @@ public static Option ToOption([CanBeNull] this T value) /// Nullable to convert. /// An . [PublicAPI, Pure] - public static Option ToOption([CanBeNull] in this T? nullable) + public static Option ToOption([CanBeNull] this T? nullable) where T : struct { return nullable?.ToOption() ?? Option.None; @@ -42,7 +42,7 @@ public static Option ToOption([CanBeNull] in this T? nullable) /// to convert. /// An . [PublicAPI, Pure] - public static T? ToNullable(in this Option option) + public static T? ToNullable(this Option option) where T : struct { return option.HasValue @@ -56,7 +56,7 @@ public static Option ToOption([CanBeNull] in this T? nullable) /// An . /// Flattened . [PublicAPI, Pure] - public static Option Flatten(in this Option> embeddedOption) + public static Option Flatten(this Option> embeddedOption) { return embeddedOption.HasValue ? embeddedOption.Value : Option.None; } @@ -95,7 +95,7 @@ public static Option NoneIfEmptyOrSpace([CanBeNull] this string str) /// on which applying the treatment. /// An . [PublicAPI, Pure] - public static Option NoneIfEmpty(in this Option option) + public static Option NoneIfEmpty(this Option option) { return option.IfElse( str => string.IsNullOrEmpty(str) ? Option.None : Option.Some(str), @@ -109,7 +109,7 @@ public static Option NoneIfEmpty(in this Option option) /// on which applying the treatment. /// An . [PublicAPI, Pure] - public static Option NoneIfEmptyOrSpace(in this Option option) + public static Option NoneIfEmptyOrSpace(this Option option) { return option.IfElse( str => string.IsNullOrWhiteSpace(str) ? Option.None : Option.Some(str), diff --git a/src/Here/Option/Extensions/OptionLinqEnumerableExtensions.cs b/src/Here/Option/Extensions/OptionLinqEnumerableExtensions.cs index aa8e5dc..069ed19 100644 --- a/src/Here/Option/Extensions/OptionLinqEnumerableExtensions.cs +++ b/src/Here/Option/Extensions/OptionLinqEnumerableExtensions.cs @@ -18,7 +18,7 @@ public static class OptionLinqEnumerableExtensions /// on which performing the check. /// True if this enumerable value has at least one value, otherwise false. [PublicAPI, Pure] - public static bool AnyItem(in this Option option) + public static bool AnyItem(this Option option) where T : IEnumerable { if (option.HasValue) @@ -35,7 +35,7 @@ public static bool AnyItem(in this Option option) /// True if this enumerable has at least one value that matches, otherwise false. /// If the is null. [PublicAPI, Pure] - public static bool AnyItem(in this Option option, [NotNull, InstantHandle] in Predicate predicate) + public static bool AnyItem(this Option option, [NotNull, InstantHandle] Predicate predicate) where T : IEnumerable { Throw.IfArgumentNull(predicate, nameof(predicate)); @@ -62,7 +62,7 @@ public static bool AnyItem(in this Option option, [NotNull, InstantHandle] /// True if this enumerable has at least one value that match, otherwise false. /// If the is null. [PublicAPI, Pure] - public static bool AnyItem(in this Option option, [NotNull, InstantHandle] Predicate predicate) + public static bool AnyItem(this Option option, [NotNull, InstantHandle] Predicate predicate) where T : IEnumerable { Throw.IfArgumentNull(predicate, nameof(predicate)); @@ -81,7 +81,7 @@ public static bool AnyItem(in this Option option, [NotNull, Instant /// True if this enumerable items all match the , otherwise false. /// If the is null. [PublicAPI, Pure] - public static bool AllItems(in this Option option, [NotNull, InstantHandle] in Predicate predicate) + public static bool AllItems(this Option option, [NotNull, InstantHandle] Predicate predicate) where T : IEnumerable { Throw.IfArgumentNull(predicate, nameof(predicate)); @@ -110,7 +110,7 @@ public static bool AllItems(in this Option option, [NotNull, InstantHandle /// True if this enumerable items all match the , otherwise false. /// If the is null. [PublicAPI, Pure] - public static bool AllItems(in this Option option, [NotNull, InstantHandle] Predicate predicate) + public static bool AllItems(this Option option, [NotNull, InstantHandle] Predicate predicate) where T : IEnumerable { Throw.IfArgumentNull(predicate, nameof(predicate)); @@ -128,7 +128,7 @@ public static bool AllItems(in this Option option, [NotNull, Instan /// Value to check equality with value. /// True if this contains the , otherwise false. [PublicAPI, Pure] - public static bool ContainsItem(in this Option option, [CanBeNull] in object value) + public static bool ContainsItem(this Option option, [CanBeNull] object value) where T : IEnumerable { if (option.HasValue) @@ -153,7 +153,7 @@ public static bool ContainsItem(in this Option option, [CanBeNull] in obje /// True if this contains the , otherwise false. /// If the is null. [PublicAPI, Pure] - public static bool ContainsItem(in this Option option, [CanBeNull] in object value, [NotNull] in IEqualityComparer comparer) + public static bool ContainsItem(this Option option, [CanBeNull] object value, [NotNull] IEqualityComparer comparer) where T : IEnumerable { Throw.IfArgumentNull(comparer, nameof(comparer)); @@ -179,7 +179,7 @@ public static bool ContainsItem(in this Option option, [CanBeNull] in obje /// Value to check equality with value. /// True if this contains the , otherwise false. [PublicAPI, Pure] - public static bool ContainsItem(in this Option option, [CanBeNull] in TItem value) + public static bool ContainsItem(this Option option, [CanBeNull] TItem value) where T : IEnumerable { if (option.HasValue) @@ -198,7 +198,7 @@ public static bool ContainsItem(in this Option option, [CanBeNull] /// True if this contains the , otherwise false. /// If the is null. [PublicAPI, Pure] - public static bool ContainsItem(in this Option option, [CanBeNull] in TItem value, [NotNull] in IEqualityComparer comparer) + public static bool ContainsItem(this Option option, [CanBeNull] TItem value, [NotNull] IEqualityComparer comparer) where T : IEnumerable { Throw.IfArgumentNull(comparer, nameof(comparer)); @@ -218,7 +218,7 @@ public static bool ContainsItem(in this Option option, [CanBeNull] /// A with selected items. /// If the is null. [PublicAPI, Pure] - public static Option> SelectItems(in this Option option, [NotNull, InstantHandle] in Func selector) + public static Option> SelectItems(this Option option, [NotNull, InstantHandle] Func selector) where T : IEnumerable { Throw.IfArgumentNull(selector, nameof(selector)); @@ -248,7 +248,7 @@ public static Option> SelectItems(in this Opt /// A with selected items. /// If the is null. [PublicAPI, Pure] - public static Option> SelectItems(in this Option option, [NotNull, InstantHandle] in Func selector) + public static Option> SelectItems(this Option option, [NotNull, InstantHandle] Func selector) where T : IEnumerable { Throw.IfArgumentNull(selector, nameof(selector)); @@ -272,7 +272,7 @@ public static Option> SelectItems(in /// A with matched items. /// If the is null. [PublicAPI, Pure] - public static Option WhereItems(in this Option option, [NotNull, InstantHandle] in Predicate predicate) + public static Option WhereItems(this Option option, [NotNull, InstantHandle] Predicate predicate) where T : IEnumerable { Throw.IfArgumentNull(predicate, nameof(predicate)); @@ -304,7 +304,7 @@ public static Option WhereItems(in this Option option, [NotNu /// A with matched items. /// If the is null. [PublicAPI, Pure] - public static Option> WhereItems(in this Option option, [NotNull, InstantHandle] Predicate predicate) + public static Option> WhereItems(this Option option, [NotNull, InstantHandle] Predicate predicate) where T : IEnumerable { Throw.IfArgumentNull(predicate, nameof(predicate)); @@ -329,7 +329,7 @@ public static Option> WhereItems(in this Option /// This . /// If the is null. [PublicAPI] - public static Option ForEachItems(in this Option option, [NotNull, InstantHandle] in Action onItem) + public static Option ForEachItems(this Option option, [NotNull, InstantHandle] Action onItem) where T : IEnumerable { Throw.IfArgumentNull(onItem, nameof(onItem)); @@ -353,7 +353,7 @@ public static Option ForEachItems(in this Option option, [NotNull, Inst /// This . /// If the is null. [PublicAPI] - public static Option ForEachItems(in this Option option, [NotNull, InstantHandle] in Action onItem) + public static Option ForEachItems(this Option option, [NotNull, InstantHandle] Action onItem) where T : IEnumerable { Throw.IfArgumentNull(onItem, nameof(onItem)); @@ -381,9 +381,9 @@ public static Option ForEachItems(in this Option option, [NotNul /// If the is null. /// If the is null. [PublicAPI, NotNull, Pure] - public static TAggregate AggregateItems(in this Option option, - [NotNull] in TAggregate initialValue, - [NotNull, InstantHandle] in Func aggregator) + public static TAggregate AggregateItems(this Option option, + [NotNull] TAggregate initialValue, + [NotNull, InstantHandle] Func aggregator) where T : IEnumerable { Throw.IfArgumentNull(initialValue, nameof(initialValue)); @@ -416,9 +416,9 @@ public static TAggregate AggregateItems(in this Option option, /// If the is null. /// If the is null. [PublicAPI, NotNull, Pure] - public static TAggregate AggregateItems(in this Option option, - [NotNull] in TAggregate initialValue, - [NotNull, InstantHandle] in Func aggregator) + public static TAggregate AggregateItems(this Option option, + [NotNull] TAggregate initialValue, + [NotNull, InstantHandle] Func aggregator) where T : IEnumerable { Throw.IfArgumentNull(initialValue, nameof(initialValue)); diff --git a/src/Here/Option/Extensions/OptionLinqExtensions.cs b/src/Here/Option/Extensions/OptionLinqExtensions.cs index 77893d1..144a08f 100644 --- a/src/Here/Option/Extensions/OptionLinqExtensions.cs +++ b/src/Here/Option/Extensions/OptionLinqExtensions.cs @@ -16,7 +16,7 @@ public static class OptionLinqExtensions /// on which performing the check. /// True if this has a value, otherwise false. [PublicAPI, Pure] - public static bool Any(in this Option option) + public static bool Any(this Option option) { return option.HasValue; } @@ -30,7 +30,7 @@ public static bool Any(in this Option option) /// True if this matches the predicate, otherwise false. /// If the is null. [PublicAPI, Pure] - public static bool Any(in this Option option, [NotNull, InstantHandle] in Predicate predicate) + public static bool Any(this Option option, [NotNull, InstantHandle] Predicate predicate) { return option.Exists(predicate); } @@ -44,7 +44,7 @@ public static bool Any(in this Option option, [NotNull, InstantHandle] in /// True if this value matches the predicate, otherwise false. /// If the is null. [PublicAPI, Pure] - public static bool All(in this Option option, [NotNull, InstantHandle] in Predicate predicate) + public static bool All(this Option option, [NotNull, InstantHandle] Predicate predicate) { return option.Exists(predicate); } @@ -57,7 +57,7 @@ public static bool All(in this Option option, [NotNull, InstantHandle] in /// Value to check equality with value. /// True if this contains the given , otherwise false. [PublicAPI, Pure] - public static bool Contains(in this Option option, [CanBeNull] in T value) + public static bool Contains(this Option option, [CanBeNull] T value) { if (option.HasValue) return EqualityComparer.Default.Equals(option.Value, value); @@ -74,7 +74,7 @@ public static bool Contains(in this Option option, [CanBeNull] in T value) /// An wrapping selected value. /// If the is null. [PublicAPI, Pure] - public static Option Select(in this Option option, [NotNull, InstantHandle] in Func selector) + public static Option Select(this Option option, [NotNull, InstantHandle] Func selector) { Throw.IfArgumentNull(selector, nameof(selector)); @@ -92,7 +92,7 @@ public static Option Select(in this Option option, [NotNul /// This if it matches the , otherwise an empty . /// If the is null. [PublicAPI, Pure] - public static Option Where(in this Option option, [NotNull, InstantHandle] in Predicate predicate) + public static Option Where(this Option option, [NotNull, InstantHandle] Predicate predicate) { if (option.Exists(predicate)) return option; @@ -108,7 +108,7 @@ public static Option Where(in this Option option, [NotNull, InstantHand /// A . /// If the is null. [PublicAPI] - public static Unit ForEach(in this Option option, [NotNull, InstantHandle] in Action doAction) + public static Unit ForEach(this Option option, [NotNull, InstantHandle] Action doAction) { Throw.IfArgumentNull(doAction, nameof(doAction)); @@ -131,9 +131,9 @@ public static Unit ForEach(in this Option option, [NotNull, InstantHandle] /// If the is null. /// If the is null. [PublicAPI, NotNull, Pure] - public static TAggregate Aggregate(in this Option option, - [NotNull] in TAggregate initialValue, - [NotNull, InstantHandle] in Func aggregator) + public static TAggregate Aggregate(this Option option, + [NotNull] TAggregate initialValue, + [NotNull, InstantHandle] Func aggregator) { Throw.IfArgumentNull(initialValue, nameof(initialValue)); Throw.IfArgumentNull(aggregator, nameof(aggregator)); diff --git a/src/Here/Option/Extensions/OptionNumericCastsExtensions.cs b/src/Here/Option/Extensions/OptionNumericCastsExtensions.cs index d1fe1d3..b7a1f77 100644 --- a/src/Here/Option/Extensions/OptionNumericCastsExtensions.cs +++ b/src/Here/Option/Extensions/OptionNumericCastsExtensions.cs @@ -14,7 +14,7 @@ public static class OptionNumericCastsExtensions #if SUPPORTS_AGGRESSIVE_INLINING [MethodImpl(MethodImplOptions.AggressiveInlining)] #endif - private static Option SafeConvert(in this Option option, [NotNull, InstantHandle] Func converter) + private static Option SafeConvert(this Option option, [NotNull, InstantHandle] Func converter) { return option.Cast( input => @@ -38,7 +38,7 @@ private static Option SafeConvert(in this Option option, /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToBool(in this Option option) + public static Option ToBool(this Option option) { return SafeConvert(option, Convert.ToBoolean); } @@ -49,7 +49,7 @@ public static Option ToBool(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToSByte(in this Option option) + public static Option ToSByte(this Option option) { return SafeConvert(option, Convert.ToSByte); } @@ -60,7 +60,7 @@ public static Option ToSByte(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToShort(in this Option option) + public static Option ToShort(this Option option) { return SafeConvert(option, Convert.ToInt16); } @@ -71,7 +71,7 @@ public static Option ToShort(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToUShort(in this Option option) + public static Option ToUShort(this Option option) { return SafeConvert(option, Convert.ToUInt16); } @@ -82,7 +82,7 @@ public static Option ToUShort(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToInt(in this Option option) + public static Option ToInt(this Option option) { return SafeConvert(option, Convert.ToInt32); } @@ -93,7 +93,7 @@ public static Option ToInt(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToUInt(in this Option option) + public static Option ToUInt(this Option option) { return SafeConvert(option, Convert.ToUInt32); } @@ -104,7 +104,7 @@ public static Option ToUInt(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToLong(in this Option option) + public static Option ToLong(this Option option) { return SafeConvert(option, Convert.ToInt64); } @@ -115,7 +115,7 @@ public static Option ToLong(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToULong(in this Option option) + public static Option ToULong(this Option option) { return SafeConvert(option, Convert.ToUInt64); } @@ -126,7 +126,7 @@ public static Option ToULong(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToDecimal(in this Option option) + public static Option ToDecimal(this Option option) { return SafeConvert(option, Convert.ToDecimal); } @@ -137,7 +137,7 @@ public static Option ToDecimal(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToFloat(in this Option option) + public static Option ToFloat(this Option option) { return SafeConvert(option, Convert.ToSingle); } @@ -148,7 +148,7 @@ public static Option ToFloat(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToDouble(in this Option option) + public static Option ToDouble(this Option option) { return SafeConvert(option, Convert.ToDouble); } @@ -163,7 +163,7 @@ public static Option ToDouble(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToBool(in this Option option) + public static Option ToBool(this Option option) { return SafeConvert(option, Convert.ToBoolean); } @@ -174,7 +174,7 @@ public static Option ToBool(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToByte(in this Option option) + public static Option ToByte(this Option option) { return SafeConvert(option, Convert.ToByte); } @@ -185,7 +185,7 @@ public static Option ToByte(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToShort(in this Option option) + public static Option ToShort(this Option option) { return SafeConvert(option, Convert.ToInt16); } @@ -196,7 +196,7 @@ public static Option ToShort(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToUShort(in this Option option) + public static Option ToUShort(this Option option) { return SafeConvert(option, Convert.ToUInt16); } @@ -207,7 +207,7 @@ public static Option ToUShort(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToInt(in this Option option) + public static Option ToInt(this Option option) { return SafeConvert(option, Convert.ToInt32); } @@ -218,7 +218,7 @@ public static Option ToInt(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToUInt(in this Option option) + public static Option ToUInt(this Option option) { return SafeConvert(option, Convert.ToUInt32); } @@ -229,7 +229,7 @@ public static Option ToUInt(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToLong(in this Option option) + public static Option ToLong(this Option option) { return SafeConvert(option, Convert.ToInt64); } @@ -240,7 +240,7 @@ public static Option ToLong(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToULong(in this Option option) + public static Option ToULong(this Option option) { return SafeConvert(option, Convert.ToUInt64); } @@ -251,7 +251,7 @@ public static Option ToULong(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToDecimal(in this Option option) + public static Option ToDecimal(this Option option) { return SafeConvert(option, Convert.ToDecimal); } @@ -262,7 +262,7 @@ public static Option ToDecimal(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToFloat(in this Option option) + public static Option ToFloat(this Option option) { return SafeConvert(option, Convert.ToSingle); } @@ -273,7 +273,7 @@ public static Option ToFloat(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToDouble(in this Option option) + public static Option ToDouble(this Option option) { return SafeConvert(option, Convert.ToDouble); } @@ -288,7 +288,7 @@ public static Option ToDouble(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToBool(in this Option option) + public static Option ToBool(this Option option) { return SafeConvert(option, Convert.ToBoolean); } @@ -299,7 +299,7 @@ public static Option ToBool(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToByte(in this Option option) + public static Option ToByte(this Option option) { return SafeConvert(option, Convert.ToByte); } @@ -310,7 +310,7 @@ public static Option ToByte(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToSByte(in this Option option) + public static Option ToSByte(this Option option) { return SafeConvert(option, Convert.ToSByte); } @@ -321,7 +321,7 @@ public static Option ToSByte(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToUShort(in this Option option) + public static Option ToUShort(this Option option) { return SafeConvert(option, Convert.ToUInt16); } @@ -332,7 +332,7 @@ public static Option ToUShort(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToInt(in this Option option) + public static Option ToInt(this Option option) { return SafeConvert(option, Convert.ToInt32); } @@ -343,7 +343,7 @@ public static Option ToInt(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToUInt(in this Option option) + public static Option ToUInt(this Option option) { return SafeConvert(option, Convert.ToUInt32); } @@ -354,7 +354,7 @@ public static Option ToUInt(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToLong(in this Option option) + public static Option ToLong(this Option option) { return SafeConvert(option, Convert.ToInt64); } @@ -365,7 +365,7 @@ public static Option ToLong(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToULong(in this Option option) + public static Option ToULong(this Option option) { return SafeConvert(option, Convert.ToUInt64); } @@ -376,7 +376,7 @@ public static Option ToULong(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToDecimal(in this Option option) + public static Option ToDecimal(this Option option) { return SafeConvert(option, Convert.ToDecimal); } @@ -387,7 +387,7 @@ public static Option ToDecimal(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToFloat(in this Option option) + public static Option ToFloat(this Option option) { return SafeConvert(option, Convert.ToSingle); } @@ -398,7 +398,7 @@ public static Option ToFloat(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToDouble(in this Option option) + public static Option ToDouble(this Option option) { return SafeConvert(option, Convert.ToDouble); } @@ -413,7 +413,7 @@ public static Option ToDouble(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToBool(in this Option option) + public static Option ToBool(this Option option) { return SafeConvert(option, Convert.ToBoolean); } @@ -424,7 +424,7 @@ public static Option ToBool(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToByte(in this Option option) + public static Option ToByte(this Option option) { return SafeConvert(option, Convert.ToByte); } @@ -435,7 +435,7 @@ public static Option ToByte(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToSByte(in this Option option) + public static Option ToSByte(this Option option) { return SafeConvert(option, Convert.ToSByte); } @@ -446,7 +446,7 @@ public static Option ToSByte(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToShort(in this Option option) + public static Option ToShort(this Option option) { return SafeConvert(option, Convert.ToInt16); } @@ -457,7 +457,7 @@ public static Option ToShort(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToInt(in this Option option) + public static Option ToInt(this Option option) { return SafeConvert(option, Convert.ToInt32); } @@ -468,7 +468,7 @@ public static Option ToInt(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToUInt(in this Option option) + public static Option ToUInt(this Option option) { return SafeConvert(option, Convert.ToUInt32); } @@ -479,7 +479,7 @@ public static Option ToUInt(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToLong(in this Option option) + public static Option ToLong(this Option option) { return SafeConvert(option, Convert.ToInt64); } @@ -490,7 +490,7 @@ public static Option ToLong(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToULong(in this Option option) + public static Option ToULong(this Option option) { return SafeConvert(option, Convert.ToUInt64); } @@ -501,7 +501,7 @@ public static Option ToULong(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToDecimal(in this Option option) + public static Option ToDecimal(this Option option) { return SafeConvert(option, Convert.ToDecimal); } @@ -512,7 +512,7 @@ public static Option ToDecimal(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToFloat(in this Option option) + public static Option ToFloat(this Option option) { return SafeConvert(option, Convert.ToSingle); } @@ -523,7 +523,7 @@ public static Option ToFloat(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToDouble(in this Option option) + public static Option ToDouble(this Option option) { return SafeConvert(option, Convert.ToDouble); } @@ -538,7 +538,7 @@ public static Option ToDouble(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToBool(in this Option option) + public static Option ToBool(this Option option) { return SafeConvert(option, Convert.ToBoolean); } @@ -549,7 +549,7 @@ public static Option ToBool(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToByte(in this Option option) + public static Option ToByte(this Option option) { return SafeConvert(option, Convert.ToByte); } @@ -560,7 +560,7 @@ public static Option ToByte(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToSByte(in this Option option) + public static Option ToSByte(this Option option) { return SafeConvert(option, Convert.ToSByte); } @@ -571,7 +571,7 @@ public static Option ToSByte(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToShort(in this Option option) + public static Option ToShort(this Option option) { return SafeConvert(option, Convert.ToInt16); } @@ -582,7 +582,7 @@ public static Option ToShort(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToUShort(in this Option option) + public static Option ToUShort(this Option option) { return SafeConvert(option, Convert.ToUInt16); } @@ -593,7 +593,7 @@ public static Option ToUShort(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToUInt(in this Option option) + public static Option ToUInt(this Option option) { return SafeConvert(option, Convert.ToUInt32); } @@ -604,7 +604,7 @@ public static Option ToUInt(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToLong(in this Option option) + public static Option ToLong(this Option option) { return SafeConvert(option, Convert.ToInt64); } @@ -615,7 +615,7 @@ public static Option ToLong(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToULong(in this Option option) + public static Option ToULong(this Option option) { return SafeConvert(option, Convert.ToUInt64); } @@ -626,7 +626,7 @@ public static Option ToULong(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToDecimal(in this Option option) + public static Option ToDecimal(this Option option) { return SafeConvert(option, Convert.ToDecimal); } @@ -637,7 +637,7 @@ public static Option ToDecimal(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToFloat(in this Option option) + public static Option ToFloat(this Option option) { return SafeConvert(option, Convert.ToSingle); } @@ -648,7 +648,7 @@ public static Option ToFloat(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToDouble(in this Option option) + public static Option ToDouble(this Option option) { return SafeConvert(option, Convert.ToDouble); } @@ -663,7 +663,7 @@ public static Option ToDouble(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToBool(in this Option option) + public static Option ToBool(this Option option) { return SafeConvert(option, Convert.ToBoolean); } @@ -674,7 +674,7 @@ public static Option ToBool(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToByte(in this Option option) + public static Option ToByte(this Option option) { return SafeConvert(option, Convert.ToByte); } @@ -685,7 +685,7 @@ public static Option ToByte(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToSByte(in this Option option) + public static Option ToSByte(this Option option) { return SafeConvert(option, Convert.ToSByte); } @@ -696,7 +696,7 @@ public static Option ToSByte(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToShort(in this Option option) + public static Option ToShort(this Option option) { return SafeConvert(option, Convert.ToInt16); } @@ -707,7 +707,7 @@ public static Option ToShort(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToUShort(in this Option option) + public static Option ToUShort(this Option option) { return SafeConvert(option, Convert.ToUInt16); } @@ -718,7 +718,7 @@ public static Option ToUShort(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToInt(in this Option option) + public static Option ToInt(this Option option) { return SafeConvert(option, Convert.ToInt32); } @@ -729,7 +729,7 @@ public static Option ToInt(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToLong(in this Option option) + public static Option ToLong(this Option option) { return SafeConvert(option, Convert.ToInt64); } @@ -740,7 +740,7 @@ public static Option ToLong(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToULong(in this Option option) + public static Option ToULong(this Option option) { return SafeConvert(option, Convert.ToUInt64); } @@ -751,7 +751,7 @@ public static Option ToULong(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToDecimal(in this Option option) + public static Option ToDecimal(this Option option) { return SafeConvert(option, Convert.ToDecimal); } @@ -762,7 +762,7 @@ public static Option ToDecimal(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToFloat(in this Option option) + public static Option ToFloat(this Option option) { return SafeConvert(option, Convert.ToSingle); } @@ -773,7 +773,7 @@ public static Option ToFloat(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToDouble(in this Option option) + public static Option ToDouble(this Option option) { return SafeConvert(option, Convert.ToDouble); } @@ -788,7 +788,7 @@ public static Option ToDouble(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToBool(in this Option option) + public static Option ToBool(this Option option) { return SafeConvert(option, Convert.ToBoolean); } @@ -799,7 +799,7 @@ public static Option ToBool(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToByte(in this Option option) + public static Option ToByte(this Option option) { return SafeConvert(option, Convert.ToByte); } @@ -810,7 +810,7 @@ public static Option ToByte(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToSByte(in this Option option) + public static Option ToSByte(this Option option) { return SafeConvert(option, Convert.ToSByte); } @@ -821,7 +821,7 @@ public static Option ToSByte(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToShort(in this Option option) + public static Option ToShort(this Option option) { return SafeConvert(option, Convert.ToInt16); } @@ -832,7 +832,7 @@ public static Option ToShort(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToUShort(in this Option option) + public static Option ToUShort(this Option option) { return SafeConvert(option, Convert.ToUInt16); } @@ -843,7 +843,7 @@ public static Option ToUShort(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToInt(in this Option option) + public static Option ToInt(this Option option) { return SafeConvert(option, Convert.ToInt32); } @@ -854,7 +854,7 @@ public static Option ToInt(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToUInt(in this Option option) + public static Option ToUInt(this Option option) { return SafeConvert(option, Convert.ToUInt32); } @@ -865,7 +865,7 @@ public static Option ToUInt(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToULong(in this Option option) + public static Option ToULong(this Option option) { return SafeConvert(option, Convert.ToUInt64); } @@ -876,7 +876,7 @@ public static Option ToULong(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToDecimal(in this Option option) + public static Option ToDecimal(this Option option) { return SafeConvert(option, Convert.ToDecimal); } @@ -887,7 +887,7 @@ public static Option ToDecimal(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToFloat(in this Option option) + public static Option ToFloat(this Option option) { return SafeConvert(option, Convert.ToSingle); } @@ -898,7 +898,7 @@ public static Option ToFloat(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToDouble(in this Option option) + public static Option ToDouble(this Option option) { return SafeConvert(option, Convert.ToDouble); } @@ -913,7 +913,7 @@ public static Option ToDouble(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToBool(in this Option option) + public static Option ToBool(this Option option) { return SafeConvert(option, Convert.ToBoolean); } @@ -924,7 +924,7 @@ public static Option ToBool(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToByte(in this Option option) + public static Option ToByte(this Option option) { return SafeConvert(option, Convert.ToByte); } @@ -935,7 +935,7 @@ public static Option ToByte(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToSByte(in this Option option) + public static Option ToSByte(this Option option) { return SafeConvert(option, Convert.ToSByte); } @@ -946,7 +946,7 @@ public static Option ToSByte(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToShort(in this Option option) + public static Option ToShort(this Option option) { return SafeConvert(option, Convert.ToInt16); } @@ -957,7 +957,7 @@ public static Option ToShort(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToUShort(in this Option option) + public static Option ToUShort(this Option option) { return SafeConvert(option, Convert.ToUInt16); } @@ -968,7 +968,7 @@ public static Option ToUShort(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToInt(in this Option option) + public static Option ToInt(this Option option) { return SafeConvert(option, Convert.ToInt32); } @@ -979,7 +979,7 @@ public static Option ToInt(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToUInt(in this Option option) + public static Option ToUInt(this Option option) { return SafeConvert(option, Convert.ToUInt32); } @@ -990,7 +990,7 @@ public static Option ToUInt(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToLong(in this Option option) + public static Option ToLong(this Option option) { return SafeConvert(option, Convert.ToInt64); } @@ -1001,7 +1001,7 @@ public static Option ToLong(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToDecimal(in this Option option) + public static Option ToDecimal(this Option option) { return SafeConvert(option, Convert.ToDecimal); } @@ -1012,7 +1012,7 @@ public static Option ToDecimal(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToFloat(in this Option option) + public static Option ToFloat(this Option option) { return SafeConvert(option, Convert.ToSingle); } @@ -1023,7 +1023,7 @@ public static Option ToFloat(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToDouble(in this Option option) + public static Option ToDouble(this Option option) { return SafeConvert(option, Convert.ToDouble); } @@ -1038,7 +1038,7 @@ public static Option ToDouble(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToBool(in this Option option) + public static Option ToBool(this Option option) { return SafeConvert(option, Convert.ToBoolean); } @@ -1049,7 +1049,7 @@ public static Option ToBool(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToByte(in this Option option) + public static Option ToByte(this Option option) { return SafeConvert(option, Convert.ToByte); } @@ -1060,7 +1060,7 @@ public static Option ToByte(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToSByte(in this Option option) + public static Option ToSByte(this Option option) { return SafeConvert(option, Convert.ToSByte); } @@ -1071,7 +1071,7 @@ public static Option ToSByte(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToShort(in this Option option) + public static Option ToShort(this Option option) { return SafeConvert(option, Convert.ToInt16); } @@ -1082,7 +1082,7 @@ public static Option ToShort(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToUShort(in this Option option) + public static Option ToUShort(this Option option) { return SafeConvert(option, Convert.ToUInt16); } @@ -1093,7 +1093,7 @@ public static Option ToUShort(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToInt(in this Option option) + public static Option ToInt(this Option option) { return SafeConvert(option, Convert.ToInt32); } @@ -1104,7 +1104,7 @@ public static Option ToInt(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToUInt(in this Option option) + public static Option ToUInt(this Option option) { return SafeConvert(option, Convert.ToUInt32); } @@ -1115,7 +1115,7 @@ public static Option ToUInt(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToLong(in this Option option) + public static Option ToLong(this Option option) { return SafeConvert(option, Convert.ToInt64); } @@ -1126,7 +1126,7 @@ public static Option ToLong(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToULong(in this Option option) + public static Option ToULong(this Option option) { return SafeConvert(option, Convert.ToUInt64); } @@ -1137,7 +1137,7 @@ public static Option ToULong(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToFloat(in this Option option) + public static Option ToFloat(this Option option) { return SafeConvert(option, Convert.ToSingle); } @@ -1148,7 +1148,7 @@ public static Option ToFloat(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToDouble(in this Option option) + public static Option ToDouble(this Option option) { return SafeConvert(option, Convert.ToDouble); } @@ -1163,7 +1163,7 @@ public static Option ToDouble(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToBool(in this Option option) + public static Option ToBool(this Option option) { return SafeConvert(option, Convert.ToBoolean); } @@ -1174,7 +1174,7 @@ public static Option ToBool(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToByte(in this Option option) + public static Option ToByte(this Option option) { return SafeConvert(option, Convert.ToByte); } @@ -1185,7 +1185,7 @@ public static Option ToByte(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToSByte(in this Option option) + public static Option ToSByte(this Option option) { return SafeConvert(option, Convert.ToSByte); } @@ -1196,7 +1196,7 @@ public static Option ToSByte(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToShort(in this Option option) + public static Option ToShort(this Option option) { return SafeConvert(option, Convert.ToInt16); } @@ -1207,7 +1207,7 @@ public static Option ToShort(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToUShort(in this Option option) + public static Option ToUShort(this Option option) { return SafeConvert(option, Convert.ToUInt16); } @@ -1218,7 +1218,7 @@ public static Option ToUShort(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToInt(in this Option option) + public static Option ToInt(this Option option) { return SafeConvert(option, Convert.ToInt32); } @@ -1229,7 +1229,7 @@ public static Option ToInt(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToUInt(in this Option option) + public static Option ToUInt(this Option option) { return SafeConvert(option, Convert.ToUInt32); } @@ -1240,7 +1240,7 @@ public static Option ToUInt(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToLong(in this Option option) + public static Option ToLong(this Option option) { return SafeConvert(option, Convert.ToInt64); } @@ -1251,7 +1251,7 @@ public static Option ToLong(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToULong(in this Option option) + public static Option ToULong(this Option option) { return SafeConvert(option, Convert.ToUInt64); } @@ -1262,7 +1262,7 @@ public static Option ToULong(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToDecimal(in this Option option) + public static Option ToDecimal(this Option option) { return SafeConvert(option, Convert.ToDecimal); } @@ -1273,7 +1273,7 @@ public static Option ToDecimal(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToDouble(in this Option option) + public static Option ToDouble(this Option option) { return SafeConvert(option, Convert.ToDouble); } @@ -1288,7 +1288,7 @@ public static Option ToDouble(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToBool(in this Option option) + public static Option ToBool(this Option option) { return SafeConvert(option, Convert.ToBoolean); } @@ -1299,7 +1299,7 @@ public static Option ToBool(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToByte(in this Option option) + public static Option ToByte(this Option option) { return SafeConvert(option, Convert.ToByte); } @@ -1310,7 +1310,7 @@ public static Option ToByte(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToSByte(in this Option option) + public static Option ToSByte(this Option option) { return SafeConvert(option, Convert.ToSByte); } @@ -1321,7 +1321,7 @@ public static Option ToSByte(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToShort(in this Option option) + public static Option ToShort(this Option option) { return SafeConvert(option, Convert.ToInt16); } @@ -1332,7 +1332,7 @@ public static Option ToShort(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToUShort(in this Option option) + public static Option ToUShort(this Option option) { return SafeConvert(option, Convert.ToUInt16); } @@ -1343,7 +1343,7 @@ public static Option ToUShort(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToInt(in this Option option) + public static Option ToInt(this Option option) { return SafeConvert(option, Convert.ToInt32); } @@ -1354,7 +1354,7 @@ public static Option ToInt(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToUInt(in this Option option) + public static Option ToUInt(this Option option) { return SafeConvert(option, Convert.ToUInt32); } @@ -1365,7 +1365,7 @@ public static Option ToUInt(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToLong(in this Option option) + public static Option ToLong(this Option option) { return SafeConvert(option, Convert.ToInt64); } @@ -1376,7 +1376,7 @@ public static Option ToLong(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToULong(in this Option option) + public static Option ToULong(this Option option) { return SafeConvert(option, Convert.ToUInt64); } @@ -1387,7 +1387,7 @@ public static Option ToULong(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToDecimal(in this Option option) + public static Option ToDecimal(this Option option) { return SafeConvert(option, Convert.ToDecimal); } @@ -1398,7 +1398,7 @@ public static Option ToDecimal(in this Option option) /// The to convert. /// The result of the conversion. [PublicAPI, Pure] - public static Option ToFloat(in this Option option) + public static Option ToFloat(this Option option) { return SafeConvert(option, Convert.ToSingle); } diff --git a/src/Here/Option/Extensions/OptionOperatorsExtensions.cs b/src/Here/Option/Extensions/OptionOperatorsExtensions.cs index 328184d..7524827 100644 --- a/src/Here/Option/Extensions/OptionOperatorsExtensions.cs +++ b/src/Here/Option/Extensions/OptionOperatorsExtensions.cs @@ -18,7 +18,7 @@ public static class OptionOperatorsExtensions /// Failure message in case this has no value. /// The corresponding . [PublicAPI, Pure] - public static Result ToResult(in this Option option, [CanBeNull] in string failureMessage = null) + public static Result ToResult(this Option option, [CanBeNull] string failureMessage = null) { if (option.HasValue) return Result.Ok(); @@ -33,7 +33,7 @@ public static Result ToResult(in this Option option, [CanBeNull] in string /// Failure message in case the has no value. /// The corresponding . [PublicAPI, Pure] - public static Result ToValueResult(in this Option option, [CanBeNull] in string failureMessage = null) + public static Result ToValueResult(this Option option, [CanBeNull] string failureMessage = null) { if (option.HasValue) return Result.Ok(option._value); @@ -51,9 +51,9 @@ public static Result ToValueResult(in this Option option, [CanBeNull] i /// The corresponding . /// If the is null. [PublicAPI, Pure] - public static CustomResult ToCustomResult(in this Option option, - [NotNull, InstantHandle] in Func errorFactory, - [CanBeNull] in string failureMessage = null) + public static CustomResult ToCustomResult(this Option option, + [NotNull, InstantHandle] Func errorFactory, + [CanBeNull] string failureMessage = null) { Throw.IfArgumentNull(errorFactory, nameof(errorFactory)); @@ -73,9 +73,9 @@ public static CustomResult ToCustomResult(in this Option o /// The corresponding . /// If the is null. [PublicAPI, Pure] - public static CustomResult ToCustomResult(in this Option option, - [NotNull] in TError errorObject, - [CanBeNull] in string failureMessage = null) + public static CustomResult ToCustomResult(this Option option, + [NotNull] TError errorObject, + [CanBeNull] string failureMessage = null) { Throw.IfArgumentNull(errorObject, nameof(errorObject)); @@ -95,9 +95,9 @@ public static CustomResult ToCustomResult(in this Option o /// The corresponding . /// If the is null. [PublicAPI, Pure] - public static Result ToValueCustomResult(in this Option option, - [NotNull, InstantHandle] in Func errorFactory, - [CanBeNull] in string failureMessage = null) + public static Result ToValueCustomResult(this Option option, + [NotNull, InstantHandle] Func errorFactory, + [CanBeNull] string failureMessage = null) { Throw.IfArgumentNull(errorFactory, nameof(errorFactory)); @@ -117,9 +117,9 @@ public static Result ToValueCustomResult(in this Option /// The corresponding . /// If the is null. [PublicAPI, Pure] - public static Result ToValueCustomResult(in this Option option, - [NotNull] in TError errorObject, - [CanBeNull] in string failureMessage = null) + public static Result ToValueCustomResult(this Option option, + [NotNull] TError errorObject, + [CanBeNull] string failureMessage = null) { Throw.IfArgumentNull(errorObject, nameof(errorObject)); @@ -142,7 +142,7 @@ public static Result ToValueCustomResult(in this Option /// Default left value to use if the has no value. /// The corresponding . [PublicAPI, Pure] - public static Either ToEither(in this Option option, [NotNull] in TLeft defaultLeftValue) + public static Either ToEither(this Option option, [NotNull] TLeft defaultLeftValue) { Throw.IfArgumentNull(defaultLeftValue, nameof(defaultLeftValue)); @@ -162,7 +162,7 @@ public static Either ToEither(in this Option option, [Not /// has no value. /// The corresponding . [PublicAPI, Pure] - public static Either ToEither(in this Option option, [NotNull, InstantHandle] in Func leftValueFactory) + public static Either ToEither(this Option option, [NotNull, InstantHandle] Func leftValueFactory) { Throw.IfArgumentNull(leftValueFactory, nameof(leftValueFactory)); diff --git a/src/Here/Option/Extensions/OptionTryGetExtensions.cs b/src/Here/Option/Extensions/OptionTryGetExtensions.cs index b428e86..82574ef 100644 --- a/src/Here/Option/Extensions/OptionTryGetExtensions.cs +++ b/src/Here/Option/Extensions/OptionTryGetExtensions.cs @@ -46,7 +46,7 @@ public static class OptionTryGetExtensions #if SUPPORTS_AGGRESSIVE_INLINING [MethodImpl(MethodImplOptions.AggressiveInlining)] #endif - public static Option Get([CanBeNull] in TInput input, [NotNull, InstantHandle] in TryGet tryGetFunc) + public static Option Get([CanBeNull] TInput input, [NotNull, InstantHandle] TryGet tryGetFunc) { return tryGetFunc(input, out TValue result) ? result @@ -68,7 +68,7 @@ public static Option Get([CanBeNull] in TInput input, [N #if SUPPORTS_AGGRESSIVE_INLINING [MethodImpl(MethodImplOptions.AggressiveInlining)] #endif - public static Option DefaultParse([CanBeNull] in string input, [NotNull, InstantHandle] in TryParse tryParseFunc) + public static Option DefaultParse([CanBeNull] string input, [NotNull, InstantHandle] TryParse tryParseFunc) { return Parse(input, tryParseFunc, NumberStyles.Any, DefaultParseCultureInfo); } @@ -87,7 +87,7 @@ public static Option DefaultParse([CanBeNull] in string input, [ #if SUPPORTS_AGGRESSIVE_INLINING [MethodImpl(MethodImplOptions.AggressiveInlining)] #endif - public static Option Parse([CanBeNull] in string input, [NotNull, InstantHandle] in TryParse tryParseFunc, in NumberStyles style, in IFormatProvider culture) + public static Option Parse([CanBeNull] string input, [NotNull, InstantHandle] TryParse tryParseFunc, NumberStyles style, IFormatProvider culture) { return tryParseFunc(input, style, culture, out TValue result) ? result @@ -137,7 +137,7 @@ public static Option TryParseByte([CanBeNull] this string str) /// Format provider (culture) to use. /// that wrap the result of the parse. [PublicAPI, Pure] - public static Option TryParseByte([CanBeNull] this string str, in NumberStyles style, in IFormatProvider culture) + public static Option TryParseByte([CanBeNull] this string str, NumberStyles style, IFormatProvider culture) { return Parse(str, byte.TryParse, style, culture); } @@ -161,7 +161,7 @@ public static Option TryParseSByte([CanBeNull] this string str) /// Format provider (culture) to use. /// that wrap the result of the parse. [PublicAPI, Pure] - public static Option TryParseSByte([CanBeNull] this string str, in NumberStyles style, in IFormatProvider culture) + public static Option TryParseSByte([CanBeNull] this string str, NumberStyles style, IFormatProvider culture) { return Parse(str, sbyte.TryParse, style, culture); } @@ -185,7 +185,7 @@ public static Option TryParseShort([CanBeNull] this string str) /// Format provider (culture) to use. /// that wrap the result of the parse. [PublicAPI, Pure] - public static Option TryParseShort([CanBeNull] this string str, in NumberStyles style, in IFormatProvider culture) + public static Option TryParseShort([CanBeNull] this string str, NumberStyles style, IFormatProvider culture) { return Parse(str, short.TryParse, style, culture); } @@ -209,7 +209,7 @@ public static Option TryParseUShort([CanBeNull] this string str) /// Format provider (culture) to use. /// that wrap the result of the parse. [PublicAPI, Pure] - public static Option TryParseUShort([CanBeNull] this string str, in NumberStyles style, in IFormatProvider culture) + public static Option TryParseUShort([CanBeNull] this string str, NumberStyles style, IFormatProvider culture) { return Parse(str, ushort.TryParse, style, culture); } @@ -233,7 +233,7 @@ public static Option TryParseInt([CanBeNull] this string str) /// Format provider (culture) to use. /// that wrap the result of the parse. [PublicAPI, Pure] - public static Option TryParseInt([CanBeNull] this string str, in NumberStyles style, in IFormatProvider culture) + public static Option TryParseInt([CanBeNull] this string str, NumberStyles style, IFormatProvider culture) { return Parse(str, int.TryParse, style, culture); } @@ -257,7 +257,7 @@ public static Option TryParseUInt([CanBeNull] this string str) /// Format provider (culture) to use. /// that wrap the result of the parse. [PublicAPI, Pure] - public static Option TryParseUInt([CanBeNull] this string str, in NumberStyles style, in IFormatProvider culture) + public static Option TryParseUInt([CanBeNull] this string str, NumberStyles style, IFormatProvider culture) { return Parse(str, uint.TryParse, style, culture); } @@ -281,7 +281,7 @@ public static Option TryParseLong([CanBeNull] this string str) /// Format provider (culture) to use. /// that wrap the result of the parse. [PublicAPI, Pure] - public static Option TryParseLong([CanBeNull] this string str, in NumberStyles style, in IFormatProvider culture) + public static Option TryParseLong([CanBeNull] this string str, NumberStyles style, IFormatProvider culture) { return Parse(str, long.TryParse, style, culture); } @@ -305,7 +305,7 @@ public static Option TryParseULong([CanBeNull] this string str) /// Format provider (culture) to use. /// that wrap the result of the parse. [PublicAPI, Pure] - public static Option TryParseULong([CanBeNull] this string str, in NumberStyles style, in IFormatProvider culture) + public static Option TryParseULong([CanBeNull] this string str, NumberStyles style, IFormatProvider culture) { return Parse(str, ulong.TryParse, style, culture); } @@ -329,7 +329,7 @@ public static Option TryParseDecimal([CanBeNull] this string str) /// Format provider (culture) to use. /// that wrap the result of the parse. [PublicAPI, Pure] - public static Option TryParseDecimal([CanBeNull] this string str, in NumberStyles style, in IFormatProvider culture) + public static Option TryParseDecimal([CanBeNull] this string str, NumberStyles style, IFormatProvider culture) { return Parse(str, decimal.TryParse, style, culture); } @@ -353,7 +353,7 @@ public static Option TryParseFloat([CanBeNull] this string str) /// Format provider (culture) to use. /// that wrap the result of the parse. [PublicAPI, Pure] - public static Option TryParseFloat([CanBeNull] this string str, in NumberStyles style, in IFormatProvider culture) + public static Option TryParseFloat([CanBeNull] this string str, NumberStyles style, IFormatProvider culture) { return Parse(str, float.TryParse, style, culture); } @@ -377,7 +377,7 @@ public static Option TryParseDouble([CanBeNull] this string str) /// Format provider (culture) to use. /// that wrap the result of the parse. [PublicAPI, Pure] - public static Option TryParseDouble([CanBeNull] this string str, in NumberStyles style, in IFormatProvider culture) + public static Option TryParseDouble([CanBeNull] this string str, NumberStyles style, IFormatProvider culture) { return Parse(str, double.TryParse, style, culture); } diff --git a/src/Here/Option/Option.Implicit.cs b/src/Here/Option/Option.Implicit.cs index 4d5c6ef..f14b314 100644 --- a/src/Here/Option/Option.Implicit.cs +++ b/src/Here/Option/Option.Implicit.cs @@ -11,7 +11,7 @@ public partial struct Option /// /// A None option. [PublicAPI, Pure] - public static implicit operator Option([CanBeNull] in Option.NoneClass none) + public static implicit operator Option([CanBeNull] Option.NoneClass none) { return None; } @@ -22,7 +22,7 @@ public static implicit operator Option([CanBeNull] in Option.NoneClass none) /// Value to initialize the . /// An . [PublicAPI, Pure] - public static implicit operator Option([CanBeNull] in T value) + public static implicit operator Option([CanBeNull] T value) { if (value == null) return None; @@ -36,7 +36,7 @@ public static implicit operator Option([CanBeNull] in T value) /// A . /// An . [PublicAPI, Pure] - public static implicit operator Option(in Option> embeddedOption) + public static implicit operator Option(Option> embeddedOption) { return embeddedOption.Flatten(); } @@ -47,7 +47,7 @@ public static implicit operator Option(in Option> embeddedOption) /// to convert. /// A corresponding boolean. [PublicAPI, Pure] - public static implicit operator bool(in Option option) + public static implicit operator bool(Option option) { return option.HasValue; } @@ -58,7 +58,7 @@ public static implicit operator bool(in Option option) /// An to convert. /// The corresponding . [PublicAPI, Pure] - public static implicit operator Result(in Option option) + public static implicit operator Result(Option option) { return option.ToResult(); } @@ -69,7 +69,7 @@ public static implicit operator Result(in Option option) /// An to convert. /// The corresponding . [PublicAPI, Pure] - public static implicit operator Result(in Option option) + public static implicit operator Result(Option option) { return option.ToValueResult(); } diff --git a/src/Here/Option/Option.Operations.cs b/src/Here/Option/Option.Operations.cs index 193fcc9..0091127 100644 --- a/src/Here/Option/Option.Operations.cs +++ b/src/Here/Option/Option.Operations.cs @@ -16,7 +16,7 @@ public partial struct Option /// This . /// If the is null. [PublicAPI] - public Option If([NotNull, InstantHandle] in Action then) + public Option If([NotNull, InstantHandle] Action then) { Throw.IfArgumentNull(then, nameof(then)); @@ -32,7 +32,7 @@ public Option If([NotNull, InstantHandle] in Action then) /// This . /// If the is null. [PublicAPI] - public Option Else([NotNull, InstantHandle] in Action @else) + public Option Else([NotNull, InstantHandle] Action @else) { Throw.IfArgumentNull(@else, nameof(@else)); @@ -50,7 +50,7 @@ public Option Else([NotNull, InstantHandle] in Action @else) /// If the is null. /// If the is null. [PublicAPI] - public Option IfElse([NotNull, InstantHandle] in Action then, [NotNull, InstantHandle] in Action @else) + public Option IfElse([NotNull, InstantHandle] Action then, [NotNull, InstantHandle] Action @else) { Throw.IfArgumentNull(then, nameof(then)); Throw.IfArgumentNull(@else, nameof(@else)); @@ -73,7 +73,7 @@ public Option IfElse([NotNull, InstantHandle] in Action then, [NotNull, In /// If the is null. /// If the is null. [PublicAPI] - public TResult IfElse([NotNull, InstantHandle] in Func then, [NotNull, InstantHandle] in Func @else) + public TResult IfElse([NotNull, InstantHandle] Func then, [NotNull, InstantHandle] Func @else) { Throw.IfArgumentNull(then, nameof(then)); Throw.IfArgumentNull(@else, nameof(@else)); @@ -93,7 +93,7 @@ public TResult IfElse([NotNull, InstantHandle] in Func then /// If the is null. /// If the is null. [PublicAPI] - public TResult IfOr([NotNull, InstantHandle] in Func then, [NotNull] in TResult orValue) + public TResult IfOr([NotNull, InstantHandle] Func then, [NotNull] TResult orValue) { Throw.IfArgumentNull(then, nameof(then)); Throw.IfArgumentNull(orValue, nameof(orValue)); @@ -113,7 +113,7 @@ public TResult IfOr([NotNull, InstantHandle] in Func then, /// If the is null. /// If the is null. [PublicAPI] - public TResult ElseOr([NotNull, InstantHandle] in Func @else, [NotNull] in TResult orValue) + public TResult ElseOr([NotNull, InstantHandle] Func @else, [NotNull] TResult orValue) { Throw.IfArgumentNull(@else, nameof(@else)); Throw.IfArgumentNull(orValue, nameof(orValue)); @@ -130,7 +130,7 @@ public TResult ElseOr([NotNull, InstantHandle] in Func @else, /// This value, otherwise the . /// If the is null. [PublicAPI, Pure, NotNull] - public T Or([NotNull] in T orValue) + public T Or([NotNull] T orValue) { Throw.IfArgumentNull(orValue, nameof(orValue)); @@ -148,7 +148,7 @@ public T Or([NotNull] in T orValue) /// If the is null. /// If the has no value and returns null. [PublicAPI, Pure, NotNull] - public T Or([NotNull, InstantHandle] in Func orFunc) + public T Or([NotNull, InstantHandle] Func orFunc) { Throw.IfArgumentNull(orFunc, nameof(orFunc)); @@ -167,7 +167,7 @@ public T Or([NotNull, InstantHandle] in Func orFunc) /// This , otherwise the result of . /// If the is null. [PublicAPI, Pure] - public Option Or([NotNull, InstantHandle] in Func> orFunc) + public Option Or([NotNull, InstantHandle] Func> orFunc) { Throw.IfArgumentNull(orFunc, nameof(orFunc)); @@ -197,7 +197,7 @@ public T OrDefault() /// If the is null. /// If the is null. [PublicAPI] - public void IfOrThrows([NotNull, InstantHandle] in Action then, [NotNull] in Exception exception) + public void IfOrThrows([NotNull, InstantHandle] Action then, [NotNull] Exception exception) { Throw.IfArgumentNull(then, nameof(then)); Throw.IfArgumentNull(exception, nameof(exception)); @@ -216,7 +216,7 @@ public void IfOrThrows([NotNull, InstantHandle] in Action then, [NotNull] in /// If the is null. /// If the is null. [PublicAPI] - public void IfOrThrows([NotNull, InstantHandle] in Action then, [NotNull, InstantHandle] in Func exceptionFunc) + public void IfOrThrows([NotNull, InstantHandle] Action then, [NotNull, InstantHandle] Func exceptionFunc) { Throw.IfArgumentNull(then, nameof(then)); Throw.IfArgumentNull(exceptionFunc, nameof(exceptionFunc)); @@ -237,7 +237,7 @@ public void IfOrThrows([NotNull, InstantHandle] in Action then, [NotNull, Ins /// If the is null. /// If the is null. [PublicAPI] - public TResult IfOrThrows([NotNull, InstantHandle] in Func then, [NotNull] in Exception exception) + public TResult IfOrThrows([NotNull, InstantHandle] Func then, [NotNull] Exception exception) { Throw.IfArgumentNull(then, nameof(then)); Throw.IfArgumentNull(exception, nameof(exception)); @@ -257,7 +257,7 @@ public TResult IfOrThrows([NotNull, InstantHandle] in Func /// If the is null. /// If the is null. [PublicAPI] - public TResult IfOrThrows([NotNull, InstantHandle] in Func then, [NotNull, InstantHandle] in Func exceptionFunc) + public TResult IfOrThrows([NotNull, InstantHandle] Func then, [NotNull, InstantHandle] Func exceptionFunc) { Throw.IfArgumentNull(then, nameof(then)); Throw.IfArgumentNull(exceptionFunc, nameof(exceptionFunc)); @@ -274,7 +274,7 @@ public TResult IfOrThrows([NotNull, InstantHandle] in Func /// This value. /// If the is null. [PublicAPI, NotNull] - public T OrThrows([NotNull] in Exception exception) + public T OrThrows([NotNull] Exception exception) { Throw.IfArgumentNull(exception, nameof(exception)); @@ -291,7 +291,7 @@ public T OrThrows([NotNull] in Exception exception) /// This value. /// If the is null. [PublicAPI, NotNull] - public T OrThrows([NotNull, InstantHandle] in Func exceptionFunc) + public T OrThrows([NotNull, InstantHandle] Func exceptionFunc) { Throw.IfArgumentNull(exceptionFunc, nameof(exceptionFunc)); @@ -307,7 +307,7 @@ public T OrThrows([NotNull, InstantHandle] in Func exceptionFunc) /// Default value to use. /// The unwrapped value, otherwise the default one. [PublicAPI, Pure, CanBeNull] - public T Unwrap([CanBeNull] in T defaultValue = default) + public T Unwrap([CanBeNull] T defaultValue = default(T)) { if (HasValue) return _value; @@ -321,7 +321,7 @@ public T Unwrap([CanBeNull] in T defaultValue = default) /// The unwrapped value from this if it has value, otherwise the result from . /// If the is null. [PublicAPI, Pure, CanBeNull] - public T Unwrap([NotNull, InstantHandle] in Func orFunc) + public T Unwrap([NotNull, InstantHandle] Func orFunc) { Throw.IfArgumentNull(orFunc, nameof(orFunc)); @@ -342,8 +342,8 @@ public T Unwrap([NotNull, InstantHandle] in Func orFunc) /// If the is null. [PublicAPI, Pure, CanBeNull] public TOut Unwrap( - [NotNull, InstantHandle] in Func converter, - [CanBeNull] in TOut defaultValue = default) + [NotNull, InstantHandle] Func converter, + [CanBeNull] TOut defaultValue = default(TOut)) { Throw.IfArgumentNull(converter, nameof(converter)); @@ -365,8 +365,8 @@ public TOut Unwrap( /// If the is null. [PublicAPI, Pure, CanBeNull] public TOut Unwrap( - [NotNull, InstantHandle] in Func converter, - [NotNull, InstantHandle] in Func orFunc) + [NotNull, InstantHandle] Func converter, + [NotNull, InstantHandle] Func orFunc) { Throw.IfArgumentNull(converter, nameof(converter)); Throw.IfArgumentNull(orFunc, nameof(orFunc)); @@ -384,7 +384,7 @@ public TOut Unwrap( /// Converted . /// If the is null. [PublicAPI, Pure] - public Option Cast([NotNull, InstantHandle] in Func converter) + public Option Cast([NotNull, InstantHandle] Func converter) { Throw.IfArgumentNull(converter, nameof(converter)); @@ -400,7 +400,7 @@ public Option Cast([NotNull, InstantHandle] in Func converter) /// True if this matches the , otherwise false. /// If the is null. [PublicAPI, Pure] - public bool Exists([NotNull, InstantHandle] in Predicate predicate) + public bool Exists([NotNull, InstantHandle] Predicate predicate) { Throw.IfArgumentNull(predicate, nameof(predicate)); diff --git a/src/Here/Option/Option.Operators.cs b/src/Here/Option/Option.Operators.cs index ed5b23b..130fc67 100644 --- a/src/Here/Option/Option.Operators.cs +++ b/src/Here/Option/Option.Operators.cs @@ -12,7 +12,7 @@ public partial struct Option /// to check. /// True if . [PublicAPI, Pure] - public static bool operator !(in Option option) => option.HasNoValue; + public static bool operator !(Option option) => option.HasNoValue; /// /// Converts this if it has a value to an . diff --git a/src/Here/Option/Option.cs b/src/Here/Option/Option.cs index 4c68abb..222a197 100644 --- a/src/Here/Option/Option.cs +++ b/src/Here/Option/Option.cs @@ -11,7 +11,7 @@ namespace Here /// Type of the value embedded in the . [PublicAPI] [DebuggerDisplay("{" + nameof(HasValue) + " ? \"Value = \" + " + nameof(Value) + " : \"No value\"}")] - public readonly partial struct Option : IEquatable, IEquatable>, IComparable, IComparable> + public partial struct Option : IEquatable, IEquatable>, IComparable, IComparable> { /// /// Nothing value. @@ -59,7 +59,7 @@ public T Value /// Constructor. /// /// A value. - private Option([NotNull] in T value) + private Option([NotNull] T value) { HasValue = true; _value = value; @@ -71,7 +71,7 @@ private Option([NotNull] in T value) /// A value. /// If the is null. [PublicAPI] - public static Option Some([NotNull] in T value) + public static Option Some([NotNull] T value) { if (value == null) throw new ArgumentNullException(nameof(value), "Cannot initialize an Option with a null value."); @@ -111,7 +111,7 @@ public override bool Equals(object obj) /// Equality comparer to use to compare values. /// True if the value is equals to the given value, otherwise false. [Pure] - internal static bool AreEqual(in Option option, [CanBeNull] in T value, [CanBeNull] in IEqualityComparer equalityComparer = null) + internal static bool AreEqual(Option option, [CanBeNull] T value, [CanBeNull] IEqualityComparer equalityComparer = null) { if (option.HasNoValue) return false; @@ -126,7 +126,7 @@ internal static bool AreEqual(in Option option, [CanBeNull] in T value, [CanB /// Equality comparer to use to compare values. /// True if both are equal, otherwise false. [Pure] - internal static bool AreEqual(in Option option1, in Option option2, [CanBeNull] in IEqualityComparer equalityComparer = null) + internal static bool AreEqual(Option option1, Option option2, [CanBeNull] IEqualityComparer equalityComparer = null) { if (option1.HasNoValue && option2.HasNoValue) return true; @@ -149,7 +149,7 @@ public override int GetHashCode() /// First to compare. /// Second to compare. /// True if both are equal, otherwise false. - public static bool operator==(in Option option1, in Option option2) + public static bool operator==(Option option1, Option option2) { return AreEqual(option1, option2); } @@ -160,7 +160,7 @@ public override int GetHashCode() /// First to compare. /// Second to compare. /// True if are not equal, otherwise false. - public static bool operator!=(in Option option1, in Option option2) + public static bool operator!=(Option option1, Option option2) { return !(option1 == option2); } @@ -171,7 +171,7 @@ public override int GetHashCode() /// that may embed a value to compare. /// Value to compare. /// True if the value is equals to the given value, otherwise false. - public static bool operator ==(in Option option, in T value) + public static bool operator ==(Option option, T value) { return AreEqual(option, value); } @@ -182,7 +182,7 @@ public override int GetHashCode() /// that may embed a value to compare. /// Value to compare. /// True if the value is not equals to the given value, otherwise false. - public static bool operator !=(in Option option, in T value) + public static bool operator !=(Option option, T value) { return !(option == value); } @@ -193,7 +193,7 @@ public override int GetHashCode() /// Value to compare. /// that may embed a value to compare. /// True if the value is equals to the given value, otherwise false. - public static bool operator ==(in T value, in Option option) + public static bool operator ==(T value, Option option) { return option == value; } @@ -204,7 +204,7 @@ public override int GetHashCode() /// Value to compare. /// that may embed a value to compare. /// True if the value is not equals to the given value, otherwise false. - public static bool operator !=(in T value, in Option option) + public static bool operator !=(T value, Option option) { return !(option == value); } @@ -245,7 +245,7 @@ public int CompareTo(Option other) /// Equality comparer to use to compare values. /// An integer that indicates the relative order of compared objects. [Pure] - internal static int Compare(in Option option1, in Option option2, [CanBeNull] in IComparer comparer = null) + internal static int Compare(Option option1, Option option2, [CanBeNull] IComparer comparer = null) { if (option1.HasValue && !option2.HasValue) return 1; @@ -260,7 +260,7 @@ internal static int Compare(in Option option1, in Option option2, [CanBeNu /// The first to compare. /// The second to compare. /// The comparison result. - public static bool operator <(in Option left, in Option right) + public static bool operator <(Option left, Option right) { return Compare(left, right) < 0; } @@ -271,7 +271,7 @@ internal static int Compare(in Option option1, in Option option2, [CanBeNu /// The first to compare. /// The second to compare. /// The comparison result. - public static bool operator <=(in Option left, in Option right) + public static bool operator <=(Option left, Option right) { return Compare(left, right) <= 0; } @@ -282,7 +282,7 @@ internal static int Compare(in Option option1, in Option option2, [CanBeNu /// The first to compare. /// The second to compare. /// The comparison result. - public static bool operator >(in Option left, in Option right) + public static bool operator >(Option left, Option right) { return Compare(left, right) > 0; } @@ -293,7 +293,7 @@ internal static int Compare(in Option option1, in Option option2, [CanBeNu /// The first to compare. /// The second to compare. /// The comparison result. - public static bool operator >=(in Option left, in Option right) + public static bool operator >=(Option left, Option right) { return Compare(left, right) >= 0; } diff --git a/src/Here/Option/OptionHelpers.cs b/src/Here/Option/OptionHelpers.cs index 66a5143..eb78771 100644 --- a/src/Here/Option/OptionHelpers.cs +++ b/src/Here/Option/OptionHelpers.cs @@ -17,7 +17,7 @@ public static class OptionHelpers /// Equality comparer to use to compare values. /// True if both are equal, otherwise false. [PublicAPI, Pure] - public static bool AreEqual(in Option option1, in Option option2, [CanBeNull] in IEqualityComparer equalityComparer = null) + public static bool AreEqual(Option option1, Option option2, [CanBeNull] IEqualityComparer equalityComparer = null) { return Option.AreEqual(option1, option2, equalityComparer); } @@ -30,7 +30,7 @@ public static bool AreEqual(in Option option1, in Option option2, [CanB /// Equality comparer to use to compare values. /// True if the value is equals to the given value, otherwise false. [PublicAPI, Pure] - public static bool AreEqual(in Option option, [CanBeNull] in T value, [CanBeNull] in IEqualityComparer equalityComparer = null) + public static bool AreEqual(Option option, [CanBeNull] T value, [CanBeNull] IEqualityComparer equalityComparer = null) { return Option.AreEqual(option, value, equalityComparer); } @@ -45,7 +45,7 @@ public static bool AreEqual(in Option option, [CanBeNull] in T value, [Can /// Equality comparer to use to compare values. /// An integer that indicates the relative order of compared objects. [PublicAPI, Pure] - public static int Compare(in Option option1, in Option option2, [CanBeNull] in IComparer comparer = null) + public static int Compare(Option option1, Option option2, [CanBeNull] IComparer comparer = null) { return Option.Compare(option1, option2, comparer); } diff --git a/src/Here/Result/CustomErrorResult.cs b/src/Here/Result/CustomErrorResult.cs index 6681f2e..cfe28c5 100644 --- a/src/Here/Result/CustomErrorResult.cs +++ b/src/Here/Result/CustomErrorResult.cs @@ -10,7 +10,7 @@ namespace Here /// [PublicAPI] [DebuggerDisplay("{" + nameof(IsSuccess) + " ? \"IsSuccess\" + (" + nameof(IsWarning) + " ? \" with warning\" : System.String.Empty) : \"IsFailure\"}")] - public readonly partial struct CustomResult : IResultError, IEquatable>, IComparable, IComparable> + public partial struct CustomResult : IResultError, IEquatable>, IComparable, IComparable> { /// /// A success . @@ -45,7 +45,7 @@ namespace Here /// constructor. /// /// Result logic. - internal CustomResult([NotNull] in ResultLogic logic) + internal CustomResult([NotNull] ResultLogic logic) { Logic = logic; } @@ -57,7 +57,7 @@ internal CustomResult([NotNull] in ResultLogic logic) /// Result message. /// Result error. /// Result embedded exception. - internal CustomResult(in bool isWarning, [NotNull] in string message, [CanBeNull] in TError error, [CanBeNull] in Exception exception) + internal CustomResult(bool isWarning, [NotNull] string message, [CanBeNull] TError error, [CanBeNull] Exception exception) { Logic = new ResultLogic(isWarning, message, error, exception); } @@ -71,7 +71,7 @@ internal CustomResult(in bool isWarning, [NotNull] in string message, [CanBeNull /// Value. /// A . [PublicAPI, Pure] - public Result Cast([CanBeNull] in T value) + public Result Cast([CanBeNull] T value) { if (IsFailure) return ToFailValueResult(); @@ -86,7 +86,7 @@ public Result Cast([CanBeNull] in T value) /// A . /// If the is null. [PublicAPI, Pure] - public Result Cast([NotNull, InstantHandle] in Func valueFactory) + public Result Cast([NotNull, InstantHandle] Func valueFactory) { Throw.IfArgumentNull(valueFactory, nameof(valueFactory)); @@ -102,7 +102,7 @@ public Result Cast([NotNull, InstantHandle] in Func valueFactory) /// Value. /// A . [PublicAPI, Pure] - public Result CustomCast([CanBeNull] in T value) + public Result CustomCast([CanBeNull] T value) { if (IsFailure) return ToFailValueCustomResult(); @@ -119,7 +119,7 @@ public Result CustomCast([CanBeNull] in T value) /// A . /// If the is null. [PublicAPI, Pure] - public Result CustomCast([NotNull, InstantHandle] in Func valueFactory) + public Result CustomCast([NotNull, InstantHandle] Func valueFactory) { Throw.IfArgumentNull(valueFactory, nameof(valueFactory)); @@ -165,7 +165,7 @@ internal Result ToFailValueResult() /// Custom error object to use. /// A failed . [Pure] - internal CustomResult ToFailCustomResult([NotNull] in TError errorObject) + internal CustomResult ToFailCustomResult([NotNull] TError errorObject) { Debug.Assert(ResultLogic.IsConvertibleToFailure(Logic), "Cannot convert a success CustomResult to a CustomResult failure."); return Result.CustomFail(Logic.Message, errorObject, Logic.Exception); @@ -179,7 +179,7 @@ internal CustomResult ToFailCustomResult([NotNull] in TError errorObject /// Exception to set in the failure . /// A failed . [Pure] - internal CustomResult ToFailCustomResult([NotNull] in string additionalMessage, [CanBeNull] in Exception exception = null) + internal CustomResult ToFailCustomResult([NotNull] string additionalMessage, [CanBeNull] Exception exception = null) { Debug.Assert(ResultLogic.IsConvertibleToFailure(Logic), "Cannot convert a success Result to a CustomResult failure."); return Result.CustomFail(Logic.Message + additionalMessage, Logic.Error, exception); @@ -204,7 +204,7 @@ internal Result ToFailValueCustomResult() /// Custom error object to use. /// A failed . [Pure] - internal Result ToFailValueCustomResult([NotNull] in TError errorObject) + internal Result ToFailValueCustomResult([NotNull] TError errorObject) { Debug.Assert(ResultLogic.IsConvertibleToFailure(Logic), "Cannot convert a success CustomResult to a Result failure."); return Result.Fail(Logic.Message, errorObject, Logic.Exception); @@ -218,7 +218,7 @@ internal Result ToFailValueCustomResult([NotNull] in TError errorO /// Exception to set in the warning . /// A warning . [Pure] - internal CustomResult ToWarnValueCustomResult([NotNull] in string message, [CanBeNull] in Exception exception = null) + internal CustomResult ToWarnValueCustomResult([NotNull] string message, [CanBeNull] Exception exception = null) { Debug.Assert(ResultLogic.IsConvertibleToWarning(Logic), "Cannot convert a warning CustomResult to a CustomResult warning."); return Result.CustomWarn(message, exception); @@ -234,7 +234,7 @@ internal CustomResult ToWarnValueCustomResult([NotNull] in string messag /// to compare. /// True if both are equal and successful, otherwise false. [PublicAPI, Pure] - public bool SuccessEquals(in CustomResult other) + public bool SuccessEquals(CustomResult other) { if (IsSuccess && other.IsSuccess) return Equals(other); @@ -261,7 +261,7 @@ public override bool Equals(object obj) /// First to compare. /// Second to compare. /// True if both are equal, otherwise false. - public static bool operator ==(in CustomResult result1, in CustomResult result2) + public static bool operator ==(CustomResult result1, CustomResult result2) { return result1.Equals(result2); } @@ -272,7 +272,7 @@ public override bool Equals(object obj) /// First to compare. /// Second to compare. /// True if both are not equal, otherwise false. - public static bool operator !=(in CustomResult result1, in CustomResult result2) + public static bool operator !=(CustomResult result1, CustomResult result2) { return !(result1 == result2); } @@ -314,7 +314,7 @@ public int CompareTo(CustomResult other) /// The first to compare. /// The second to compare. /// The comparison result. - public static bool operator <(in CustomResult left, in CustomResult right) + public static bool operator <(CustomResult left, CustomResult right) { return left.CompareTo(right) < 0; } @@ -325,7 +325,7 @@ public int CompareTo(CustomResult other) /// The first to compare. /// The second to compare. /// The comparison result. - public static bool operator <=(in CustomResult left, in CustomResult right) + public static bool operator <=(CustomResult left, CustomResult right) { return left.CompareTo(right) <= 0; } @@ -336,7 +336,7 @@ public int CompareTo(CustomResult other) /// The first to compare. /// The second to compare. /// The comparison result. - public static bool operator >(in CustomResult left, in CustomResult right) + public static bool operator >(CustomResult left, CustomResult right) { return left.CompareTo(right) > 0; } @@ -347,7 +347,7 @@ public int CompareTo(CustomResult other) /// The first to compare. /// The second to compare. /// The comparison result. - public static bool operator >=(in CustomResult left, in CustomResult right) + public static bool operator >=(CustomResult left, CustomResult right) { return left.CompareTo(right) >= 0; } diff --git a/src/Here/Result/Extensions/ResultExtensions.cs b/src/Here/Result/Extensions/ResultExtensions.cs index fa8b2af..6d5c085 100644 --- a/src/Here/Result/Extensions/ResultExtensions.cs +++ b/src/Here/Result/Extensions/ResultExtensions.cs @@ -34,7 +34,7 @@ public static bool IsOnlySuccess([NotNull] this IResult result) /// Default value to use. /// The unwrapped value from this if it has a value, otherwise the default value. [PublicAPI, Pure] - public static T Unwrap([NotNull]this IResult result, [CanBeNull] in T defaultValue = default) + public static T Unwrap([NotNull]this IResult result, [CanBeNull] T defaultValue = default(T)) { if (result.IsSuccess) return result.Value; @@ -51,7 +51,7 @@ public static T Unwrap([NotNull]this IResult result, [CanBeNull] in T defa /// The unwrapped value from this if it has a value, otherwise the default value. /// If the is null. [PublicAPI, Pure] - public static T Unwrap([NotNull] this IResult result, [NotNull, InstantHandle] in Func orFunc) + public static T Unwrap([NotNull] this IResult result, [NotNull, InstantHandle] Func orFunc) { Throw.IfArgumentNull(orFunc, nameof(orFunc)); @@ -74,8 +74,8 @@ public static T Unwrap([NotNull] this IResult result, [NotNull, InstantHan /// If the is null. [PublicAPI, Pure] public static TOut Unwrap([NotNull] this IResult result, - [NotNull, InstantHandle] in Func converter, - [CanBeNull] in TOut defaultValue = default) + [NotNull, InstantHandle] Func converter, + [CanBeNull] TOut defaultValue = default(TOut)) { Throw.IfArgumentNull(converter, nameof(converter)); @@ -99,8 +99,8 @@ public static TOut Unwrap([NotNull] this IResult result, /// If the is null. [PublicAPI, Pure] public static TOut Unwrap([NotNull] this IResult result, - [NotNull, InstantHandle] in Func converter, - [NotNull, InstantHandle] in Func orFunc) + [NotNull, InstantHandle] Func converter, + [NotNull, InstantHandle] Func orFunc) { Throw.IfArgumentNull(converter, nameof(converter)); Throw.IfArgumentNull(orFunc, nameof(orFunc)); @@ -124,7 +124,7 @@ public static TOut Unwrap([NotNull] this IResult result, /// If the is null. /// If the is null or empty. [PublicAPI, Pure] - public static Result Ensure(in this Result result, [NotNull, InstantHandle] in Func predicate, [NotNull] in string errorMessage) + public static Result Ensure(this Result result, [NotNull, InstantHandle] Func predicate, [NotNull] string errorMessage) { Throw.IfArgumentNull(predicate, nameof(predicate)); Throw.IfArgumentNull(errorMessage, nameof(errorMessage)); @@ -153,7 +153,7 @@ public static Result Ensure(in this Result result, [NotNull, InstantHandle] in F /// If the is null. /// If the is null or empty. [PublicAPI, Pure] - public static Result Ensure(in this Result result, [NotNull, InstantHandle] in Predicate predicate, [NotNull] in string errorMessage) + public static Result Ensure(this Result result, [NotNull, InstantHandle] Predicate predicate, [NotNull] string errorMessage) { Throw.IfArgumentNull(predicate, nameof(predicate)); Throw.IfArgumentNull(errorMessage, nameof(errorMessage)); @@ -173,7 +173,7 @@ public static Result Ensure(in this Result result, [NotNull, InstantHan /// A . /// Flattened . [PublicAPI, Pure] - public static Result Flatten(in this Result embeddedResult) + public static Result Flatten(this Result embeddedResult) { if (embeddedResult.IsFailure) { @@ -210,7 +210,7 @@ public static Result Flatten(in this Result embeddedResult) /// A . /// Flattened . [PublicAPI, Pure] - public static Result Flatten(in this Result> embeddedResult) + public static Result Flatten(this Result> embeddedResult) { if (embeddedResult.IsFailure) { @@ -258,10 +258,10 @@ public static Result Flatten(in this Result> embeddedResult) /// If the is null or empty. /// If the is null or empty. [PublicAPI, Pure] - public static CustomResult Ensure(in this CustomResult result, - [NotNull, InstantHandle] in Func predicate, - [NotNull] in string errorMessage, - [NotNull] in TError errorObject) + public static CustomResult Ensure(this CustomResult result, + [NotNull, InstantHandle] Func predicate, + [NotNull] string errorMessage, + [NotNull] TError errorObject) { Throw.IfArgumentNull(predicate, nameof(predicate)); Throw.IfArgumentNull(errorMessage, nameof(errorMessage)); @@ -289,10 +289,10 @@ public static CustomResult Ensure(in this CustomResult r /// If the is null or empty. /// If the is null or empty. [PublicAPI, Pure] - public static CustomResult Ensure(in this CustomResult result, - [NotNull, InstantHandle] in Func predicate, - [NotNull] in string errorMessage, - [NotNull, InstantHandle] in Func errorFactory) + public static CustomResult Ensure(this CustomResult result, + [NotNull, InstantHandle] Func predicate, + [NotNull] string errorMessage, + [NotNull, InstantHandle] Func errorFactory) { Throw.IfArgumentNull(predicate, nameof(predicate)); Throw.IfArgumentNull(errorMessage, nameof(errorMessage)); @@ -325,10 +325,10 @@ public static CustomResult Ensure(in this CustomResult r /// If the is null or empty. /// If the is null or empty. [PublicAPI, Pure] - public static Result Ensure(in this Result result, - [NotNull, InstantHandle] in Predicate predicate, - [NotNull] in string errorMessage, - [NotNull] in TError errorObject) + public static Result Ensure(this Result result, + [NotNull, InstantHandle] Predicate predicate, + [NotNull] string errorMessage, + [NotNull] TError errorObject) { Throw.IfArgumentNull(predicate, nameof(predicate)); Throw.IfArgumentNull(errorMessage, nameof(errorMessage)); @@ -357,10 +357,10 @@ public static Result Ensure(in this Result resu /// If the is null or empty. /// If the is null or empty. [PublicAPI, Pure] - public static Result Ensure(in this Result result, - [NotNull, InstantHandle] in Predicate predicate, - [NotNull] in string errorMessage, - [NotNull, InstantHandle] in Func errorFactory) + public static Result Ensure(this Result result, + [NotNull, InstantHandle] Predicate predicate, + [NotNull] string errorMessage, + [NotNull, InstantHandle] Func errorFactory) { Throw.IfArgumentNull(predicate, nameof(predicate)); Throw.IfArgumentNull(errorMessage, nameof(errorMessage)); @@ -381,7 +381,7 @@ public static Result Ensure(in this Result resu /// A . /// Flattened . [PublicAPI, Pure] - public static Result Flatten(in this Result embeddedResult) + public static Result Flatten(this Result embeddedResult) { Result tmpResult = embeddedResult; return tmpResult.Flatten(); @@ -393,7 +393,7 @@ public static Result Flatten(in this Result embeddedResu /// A . /// Flattened . [PublicAPI, Pure] - public static Result Flatten(in this Result, TError> embeddedResult) + public static Result Flatten(this Result, TError> embeddedResult) { Result> tmpResult = embeddedResult; return tmpResult.Flatten(); @@ -405,7 +405,7 @@ public static Result Flatten(in this Result, TError> emb /// A . /// Flattened . [PublicAPI, Pure] - public static CustomResult Flatten(in this Result, TError> embeddedResult) + public static CustomResult Flatten(this Result, TError> embeddedResult) { if (embeddedResult.IsFailure) { @@ -442,7 +442,7 @@ public static CustomResult Flatten(in this ResultA . /// Flattened . [PublicAPI, Pure] - public static Result Flatten(in this Result, TError> embeddedResult) + public static Result Flatten(this Result, TError> embeddedResult) { if (embeddedResult.IsFailure) { diff --git a/src/Here/Result/Extensions/ResultExtensions_OnAny.cs b/src/Here/Result/Extensions/ResultExtensions_OnAny.cs index 05e62e1..a0e8320 100644 --- a/src/Here/Result/Extensions/ResultExtensions_OnAny.cs +++ b/src/Here/Result/Extensions/ResultExtensions_OnAny.cs @@ -24,7 +24,7 @@ public static partial class ResultExtensions #if SUPPORTS_AGGRESSIVE_INLINING [MethodImpl(MethodImplOptions.AggressiveInlining)] #endif - public static Result OnAny(in this Result result, [NotNull, InstantHandle] in Action onAny) + public static Result OnAny(this Result result, [NotNull, InstantHandle] Action onAny) { Throw.IfArgumentNull(onAny, nameof(onAny)); @@ -43,7 +43,7 @@ public static Result OnAny(in this Result result, [NotNull, InstantHandle] in Ac #if SUPPORTS_AGGRESSIVE_INLINING [MethodImpl(MethodImplOptions.AggressiveInlining)] #endif - public static Result OnAny(in this Result result, [NotNull, InstantHandle] in Action onAny) + public static Result OnAny(this Result result, [NotNull, InstantHandle] Action onAny) { Throw.IfArgumentNull(onAny, nameof(onAny)); @@ -63,7 +63,7 @@ public static Result OnAny(in this Result result, [NotNull, InstantHandle] in Ac #if SUPPORTS_AGGRESSIVE_INLINING [MethodImpl(MethodImplOptions.AggressiveInlining)] #endif - public static TOut OnAny(in this Result result, [NotNull, InstantHandle] in Func onAny) + public static TOut OnAny(this Result result, [NotNull, InstantHandle] Func onAny) { Throw.IfArgumentNull(onAny, nameof(onAny)); @@ -82,7 +82,7 @@ public static TOut OnAny(in this Result result, [NotNull, InstantHandle] i #if SUPPORTS_AGGRESSIVE_INLINING [MethodImpl(MethodImplOptions.AggressiveInlining)] #endif - public static TOut OnAny(in this Result result, [NotNull, InstantHandle] in Func onAny) + public static TOut OnAny(this Result result, [NotNull, InstantHandle] Func onAny) { Throw.IfArgumentNull(onAny, nameof(onAny)); @@ -105,7 +105,7 @@ public static TOut OnAny(in this Result result, [NotNull, InstantHandle] i #if SUPPORTS_AGGRESSIVE_INLINING [MethodImpl(MethodImplOptions.AggressiveInlining)] #endif - public static Result OnAny(in this Result result, [NotNull, InstantHandle] in Action onAny) + public static Result OnAny(this Result result, [NotNull, InstantHandle] Action onAny) { Throw.IfArgumentNull(onAny, nameof(onAny)); @@ -125,7 +125,7 @@ public static Result OnAny(in this Result result, [NotNull, InstantHand #if SUPPORTS_AGGRESSIVE_INLINING [MethodImpl(MethodImplOptions.AggressiveInlining)] #endif - public static Result OnAny(in this Result result, [NotNull, InstantHandle] in Action> onAny) + public static Result OnAny(this Result result, [NotNull, InstantHandle] Action> onAny) { Throw.IfArgumentNull(onAny, nameof(onAny)); @@ -146,7 +146,7 @@ public static Result OnAny(in this Result result, [NotNull, InstantHand #if SUPPORTS_AGGRESSIVE_INLINING [MethodImpl(MethodImplOptions.AggressiveInlining)] #endif - public static TOut OnAny(in this Result result, [NotNull, InstantHandle] in Func onAny) + public static TOut OnAny(this Result result, [NotNull, InstantHandle] Func onAny) { Throw.IfArgumentNull(onAny, nameof(onAny)); @@ -166,7 +166,7 @@ public static TOut OnAny(in this Result result, [NotNull, Instan #if SUPPORTS_AGGRESSIVE_INLINING [MethodImpl(MethodImplOptions.AggressiveInlining)] #endif - public static TOut OnAny(in this Result result, [NotNull, InstantHandle] in Func, TOut> onAny) + public static TOut OnAny(this Result result, [NotNull, InstantHandle] Func, TOut> onAny) { Throw.IfArgumentNull(onAny, nameof(onAny)); @@ -189,7 +189,7 @@ public static TOut OnAny(in this Result result, [NotNull, Instan #if SUPPORTS_AGGRESSIVE_INLINING [MethodImpl(MethodImplOptions.AggressiveInlining)] #endif - public static CustomResult OnAny(in this CustomResult result, [NotNull, InstantHandle] in Action onAny) + public static CustomResult OnAny(this CustomResult result, [NotNull, InstantHandle] Action onAny) { Throw.IfArgumentNull(onAny, nameof(onAny)); @@ -209,7 +209,7 @@ public static CustomResult OnAny(in this CustomResult re #if SUPPORTS_AGGRESSIVE_INLINING [MethodImpl(MethodImplOptions.AggressiveInlining)] #endif - public static CustomResult OnAny(in this CustomResult result, [NotNull, InstantHandle] in Action> onAny) + public static CustomResult OnAny(this CustomResult result, [NotNull, InstantHandle] Action> onAny) { Throw.IfArgumentNull(onAny, nameof(onAny)); @@ -230,7 +230,7 @@ public static CustomResult OnAny(in this CustomResult re #if SUPPORTS_AGGRESSIVE_INLINING [MethodImpl(MethodImplOptions.AggressiveInlining)] #endif - public static TOut OnAny(in this CustomResult result, [NotNull, InstantHandle] in Func onAny) + public static TOut OnAny(this CustomResult result, [NotNull, InstantHandle] Func onAny) { Throw.IfArgumentNull(onAny, nameof(onAny)); @@ -250,7 +250,7 @@ public static TOut OnAny(in this CustomResult result, [Not #if SUPPORTS_AGGRESSIVE_INLINING [MethodImpl(MethodImplOptions.AggressiveInlining)] #endif - public static TOut OnAny(in this CustomResult result, [NotNull, InstantHandle] in Func, TOut> onAny) + public static TOut OnAny(this CustomResult result, [NotNull, InstantHandle] Func, TOut> onAny) { Throw.IfArgumentNull(onAny, nameof(onAny)); @@ -274,7 +274,7 @@ public static TOut OnAny(in this CustomResult result, [Not #if SUPPORTS_AGGRESSIVE_INLINING [MethodImpl(MethodImplOptions.AggressiveInlining)] #endif - public static Result OnAny(in this Result result, [NotNull, InstantHandle] in Action onAny) + public static Result OnAny(this Result result, [NotNull, InstantHandle] Action onAny) { Throw.IfArgumentNull(onAny, nameof(onAny)); @@ -295,7 +295,7 @@ public static Result OnAny(in this Result resul #if SUPPORTS_AGGRESSIVE_INLINING [MethodImpl(MethodImplOptions.AggressiveInlining)] #endif - public static Result OnAny(in this Result result, [NotNull, InstantHandle] in Action> onAny) + public static Result OnAny(this Result result, [NotNull, InstantHandle] Action> onAny) { Throw.IfArgumentNull(onAny, nameof(onAny)); @@ -317,7 +317,7 @@ public static Result OnAny(in this Result resul #if SUPPORTS_AGGRESSIVE_INLINING [MethodImpl(MethodImplOptions.AggressiveInlining)] #endif - public static TOut OnAny(in this Result result, [NotNull, InstantHandle] in Func onAny) + public static TOut OnAny(this Result result, [NotNull, InstantHandle] Func onAny) { Throw.IfArgumentNull(onAny, nameof(onAny)); @@ -338,7 +338,7 @@ public static TOut OnAny(in this Result result, #if SUPPORTS_AGGRESSIVE_INLINING [MethodImpl(MethodImplOptions.AggressiveInlining)] #endif - public static TOut OnAny(in this Result result, [NotNull, InstantHandle] in Func, TOut> onAny) + public static TOut OnAny(this Result result, [NotNull, InstantHandle] Func, TOut> onAny) { Throw.IfArgumentNull(onAny, nameof(onAny)); diff --git a/src/Here/Result/Extensions/ResultExtensions_OnFailure.cs b/src/Here/Result/Extensions/ResultExtensions_OnFailure.cs index 0ac738e..d02da48 100644 --- a/src/Here/Result/Extensions/ResultExtensions_OnFailure.cs +++ b/src/Here/Result/Extensions/ResultExtensions_OnFailure.cs @@ -19,7 +19,7 @@ public static partial class ResultExtensions /// This . /// If the is null. [PublicAPI] - public static Result OnFailure(in this Result result, [NotNull, InstantHandle] in Action onFailure, in bool treatWarningAsError = false) + public static Result OnFailure(this Result result, [NotNull, InstantHandle] Action onFailure, bool treatWarningAsError = false) { Throw.IfArgumentNull(onFailure, nameof(onFailure)); @@ -38,7 +38,7 @@ public static Result OnFailure(in this Result result, [NotNull, InstantHandle] i /// This . /// If the is null. [PublicAPI] - public static Result OnFailure(in this Result result, [NotNull, InstantHandle] in Action onFailure, in bool treatWarningAsError = false) + public static Result OnFailure(this Result result, [NotNull, InstantHandle] Action onFailure, bool treatWarningAsError = false) { Throw.IfArgumentNull(onFailure, nameof(onFailure)); @@ -59,10 +59,10 @@ public static Result OnFailure(in this Result result, [NotNull, InstantHandle] i /// An output value. /// If the is null. [PublicAPI] - public static TOut OnFailure(in this Result result, - [NotNull, InstantHandle] in Func onFailure, - [CanBeNull] in TOut defaultValue, - in bool treatWarningAsError = false) + public static TOut OnFailure(this Result result, + [NotNull, InstantHandle] Func onFailure, + [CanBeNull] TOut defaultValue, + bool treatWarningAsError = false) { Throw.IfArgumentNull(onFailure, nameof(onFailure)); @@ -84,10 +84,10 @@ public static TOut OnFailure(in this Result result, /// If the is null. /// If the is null. [PublicAPI] - public static TOut OnFailure(in this Result result, - [NotNull, InstantHandle] in Func onFailure, - [NotNull, InstantHandle] in Func valueFactory, - in bool treatWarningAsError = false) + public static TOut OnFailure(this Result result, + [NotNull, InstantHandle] Func onFailure, + [NotNull, InstantHandle] Func valueFactory, + bool treatWarningAsError = false) { Throw.IfArgumentNull(onFailure, nameof(onFailure)); Throw.IfArgumentNull(valueFactory, nameof(valueFactory)); @@ -111,7 +111,7 @@ public static TOut OnFailure(in this Result result, /// This . /// If the is null. [PublicAPI] - public static Result OnFailure(in this Result result, [NotNull, InstantHandle] in Action onFailure, in bool treatWarningAsError = false) + public static Result OnFailure(this Result result, [NotNull, InstantHandle] Action onFailure, bool treatWarningAsError = false) { Throw.IfArgumentNull(onFailure, nameof(onFailure)); @@ -131,7 +131,7 @@ public static Result OnFailure(in this Result result, [NotNull, Instant /// This . /// If the is null. [PublicAPI] - public static Result OnFailure(in this Result result, [NotNull, InstantHandle] in Action> onFailure, in bool treatWarningAsError = false) + public static Result OnFailure(this Result result, [NotNull, InstantHandle] Action> onFailure, bool treatWarningAsError = false) { Throw.IfArgumentNull(onFailure, nameof(onFailure)); @@ -153,10 +153,10 @@ public static Result OnFailure(in this Result result, [NotNull, Instant /// An output value. /// If the is null. [PublicAPI] - public static TOut OnFailure(in this Result result, - [NotNull, InstantHandle] in Func, TOut> onFailure, - [CanBeNull] in TOut defaultValue, - in bool treatWarningAsError = false) + public static TOut OnFailure(this Result result, + [NotNull, InstantHandle] Func, TOut> onFailure, + [CanBeNull] TOut defaultValue, + bool treatWarningAsError = false) { Throw.IfArgumentNull(onFailure, nameof(onFailure)); @@ -179,10 +179,10 @@ public static TOut OnFailure(in this Result result, /// If the is null. /// If the is null. [PublicAPI] - public static TOut OnFailure(in this Result result, - [NotNull, InstantHandle] in Func, TOut> onFailure, - [NotNull, InstantHandle] in Func valueFactory, - in bool treatWarningAsError = false) + public static TOut OnFailure(this Result result, + [NotNull, InstantHandle] Func, TOut> onFailure, + [NotNull, InstantHandle] Func valueFactory, + bool treatWarningAsError = false) { Throw.IfArgumentNull(onFailure, nameof(onFailure)); Throw.IfArgumentNull(valueFactory, nameof(valueFactory)); @@ -206,9 +206,9 @@ public static TOut OnFailure(in this Result result, /// This . /// If the is null. [PublicAPI] - public static CustomResult OnFailure(in this CustomResult result, - [NotNull, InstantHandle] in Action onFailure, - in bool treatWarningAsError = false) + public static CustomResult OnFailure(this CustomResult result, + [NotNull, InstantHandle] Action onFailure, + bool treatWarningAsError = false) { Throw.IfArgumentNull(onFailure, nameof(onFailure)); @@ -228,9 +228,9 @@ public static CustomResult OnFailure(in this CustomResultThis . /// If the is null. [PublicAPI] - public static CustomResult OnFailure(in this CustomResult result, - [NotNull, InstantHandle] in Action> onFailure, - in bool treatWarningAsError = false) + public static CustomResult OnFailure(this CustomResult result, + [NotNull, InstantHandle] Action> onFailure, + bool treatWarningAsError = false) { Throw.IfArgumentNull(onFailure, nameof(onFailure)); @@ -252,10 +252,10 @@ public static CustomResult OnFailure(in this CustomResultAn output value. /// If the is null. [PublicAPI] - public static TOut OnFailure(in this CustomResult result, - [NotNull, InstantHandle] in Func, TOut> onFailure, - [CanBeNull] in TOut defaultValue, - in bool treatWarningAsError = false) + public static TOut OnFailure(this CustomResult result, + [NotNull, InstantHandle] Func, TOut> onFailure, + [CanBeNull] TOut defaultValue, + bool treatWarningAsError = false) { Throw.IfArgumentNull(onFailure, nameof(onFailure)); @@ -278,10 +278,10 @@ public static TOut OnFailure(in this CustomResult result, /// If the is null. /// If the is null. [PublicAPI] - public static TOut OnFailure(in this CustomResult result, - [NotNull, InstantHandle] in Func, TOut> onFailure, - [NotNull, InstantHandle] in Func valueFactory, - in bool treatWarningAsError = false) + public static TOut OnFailure(this CustomResult result, + [NotNull, InstantHandle] Func, TOut> onFailure, + [NotNull, InstantHandle] Func valueFactory, + bool treatWarningAsError = false) { Throw.IfArgumentNull(onFailure, nameof(onFailure)); Throw.IfArgumentNull(valueFactory, nameof(valueFactory)); @@ -306,9 +306,9 @@ public static TOut OnFailure(in this CustomResult result, /// This . /// If the is null. [PublicAPI] - public static Result OnFailure(in this Result result, - [NotNull, InstantHandle] in Action onFailure, - in bool treatWarningAsError = false) + public static Result OnFailure(this Result result, + [NotNull, InstantHandle] Action onFailure, + bool treatWarningAsError = false) { Throw.IfArgumentNull(onFailure, nameof(onFailure)); @@ -329,9 +329,9 @@ public static Result OnFailure(in this Result r /// This . /// If the is null. [PublicAPI] - public static Result OnFailure(in this Result result, - [NotNull, InstantHandle] in Action> onFailure, - in bool treatWarningAsError = false) + public static Result OnFailure(this Result result, + [NotNull, InstantHandle] Action> onFailure, + bool treatWarningAsError = false) { Throw.IfArgumentNull(onFailure, nameof(onFailure)); @@ -354,10 +354,10 @@ public static Result OnFailure(in this Result r /// An output value. /// If the is null. [PublicAPI] - public static TOut OnFailure(in this Result result, - [NotNull, InstantHandle] in Func, TOut> onFailure, - [CanBeNull] in TOut defaultValue, - in bool treatWarningAsError = false) + public static TOut OnFailure(this Result result, + [NotNull, InstantHandle] Func, TOut> onFailure, + [CanBeNull] TOut defaultValue, + bool treatWarningAsError = false) { Throw.IfArgumentNull(onFailure, nameof(onFailure)); @@ -381,10 +381,10 @@ public static TOut OnFailure(in this Result resu /// If the is null. /// If the is null. [PublicAPI] - public static TOut OnFailure(in this Result result, - [NotNull, InstantHandle] in Func, TOut> onFailure, - [NotNull, InstantHandle] in Func valueFactory, - in bool treatWarningAsError = false) + public static TOut OnFailure(this Result result, + [NotNull, InstantHandle] Func, TOut> onFailure, + [NotNull, InstantHandle] Func valueFactory, + bool treatWarningAsError = false) { Throw.IfArgumentNull(onFailure, nameof(onFailure)); Throw.IfArgumentNull(valueFactory, nameof(valueFactory)); diff --git a/src/Here/Result/Extensions/ResultExtensions_OnSuccess.cs b/src/Here/Result/Extensions/ResultExtensions_OnSuccess.cs index 47d2971..fa6a60e 100644 --- a/src/Here/Result/Extensions/ResultExtensions_OnSuccess.cs +++ b/src/Here/Result/Extensions/ResultExtensions_OnSuccess.cs @@ -20,7 +20,7 @@ public static partial class ResultExtensions #if SUPPORTS_AGGRESSIVE_INLINING [MethodImpl(MethodImplOptions.AggressiveInlining)] #endif - private static bool IsConsideredFailure([NotNull] in IResult result, in bool treatWarningAsError) + private static bool IsConsideredFailure([NotNull] IResult result, bool treatWarningAsError) { return result.IsFailure || (treatWarningAsError && result.IsWarning); } @@ -34,7 +34,7 @@ private static bool IsConsideredFailure([NotNull] in IResult result, in bool tre #if SUPPORTS_AGGRESSIVE_INLINING [MethodImpl(MethodImplOptions.AggressiveInlining)] #endif - private static bool IsConsideredSuccess([NotNull] in IResult result, in bool treatWarningAsError) + private static bool IsConsideredSuccess([NotNull] IResult result, bool treatWarningAsError) { return !IsConsideredFailure(result, treatWarningAsError); } @@ -50,7 +50,7 @@ private static bool IsConsideredSuccess([NotNull] in IResult result, in bool tre /// This . /// If the is null. [PublicAPI] - public static Result OnSuccess(in this Result result, [NotNull, InstantHandle] in Action onSuccess, in bool treatWarningAsError = false) + public static Result OnSuccess(this Result result, [NotNull, InstantHandle] Action onSuccess, bool treatWarningAsError = false) { Throw.IfArgumentNull(onSuccess, nameof(onSuccess)); @@ -69,7 +69,7 @@ public static Result OnSuccess(in this Result result, [NotNull, InstantHandle] i /// This . /// If the is null. [PublicAPI] - public static Result OnSuccess(in this Result result, [NotNull, InstantHandle] in Action onSuccess, in bool treatWarningAsError = false) + public static Result OnSuccess(this Result result, [NotNull, InstantHandle] Action onSuccess, bool treatWarningAsError = false) { Throw.IfArgumentNull(onSuccess, nameof(onSuccess)); @@ -88,7 +88,7 @@ public static Result OnSuccess(in this Result result, [NotNull, InstantHandle] i /// A resulting of , otherwise a failure. /// If the is null. [PublicAPI] - public static Result OnSuccess(in this Result result, [NotNull, InstantHandle] in Func onSuccess, in bool treatWarningAsError = false) + public static Result OnSuccess(this Result result, [NotNull, InstantHandle] Func onSuccess, bool treatWarningAsError = false) { Throw.IfArgumentNull(onSuccess, nameof(onSuccess)); @@ -110,7 +110,7 @@ public static Result OnSuccess(in this Result result, [NotNull, InstantHandle] i /// A resulting of , otherwise a failure. /// If the is null. [PublicAPI] - public static Result OnSuccess(in this Result result, [NotNull, InstantHandle] in Func onSuccess, in bool treatWarningAsError = false) + public static Result OnSuccess(this Result result, [NotNull, InstantHandle] Func onSuccess, bool treatWarningAsError = false) { Throw.IfArgumentNull(onSuccess, nameof(onSuccess)); @@ -130,7 +130,7 @@ public static Result OnSuccess(in this Result result, [NotNull, InstantHan /// A resulting of , otherwise a failure. /// If the is null. [PublicAPI] - public static Result OnSuccess(in this Result result, [NotNull, InstantHandle] in Func> onSuccess, in bool treatWarningAsError = false) + public static Result OnSuccess(this Result result, [NotNull, InstantHandle] Func> onSuccess, bool treatWarningAsError = false) { Throw.IfArgumentNull(onSuccess, nameof(onSuccess)); @@ -154,10 +154,10 @@ public static Result OnSuccess(in this Result result, [NotNull, InstantHan /// If the is null. /// If the is null. [PublicAPI] - public static CustomResult OnSuccess(in this Result result, - [NotNull, InstantHandle] in Func> onSuccess, - [NotNull] in TError errorObject, - in bool treatWarningAsError = false) + public static CustomResult OnSuccess(this Result result, + [NotNull, InstantHandle] Func> onSuccess, + [NotNull] TError errorObject, + bool treatWarningAsError = false) { Throw.IfArgumentNull(onSuccess, nameof(onSuccess)); Throw.IfArgumentNull(errorObject, nameof(errorObject)); @@ -182,10 +182,10 @@ public static CustomResult OnSuccess(in this Result result, /// If the is null. /// If the is null. [PublicAPI] - public static CustomResult OnSuccess(in this Result result, - [NotNull, InstantHandle] in Func> onSuccess, - [NotNull, InstantHandle] in Func errorFactory, - in bool treatWarningAsError = false) + public static CustomResult OnSuccess(this Result result, + [NotNull, InstantHandle] Func> onSuccess, + [NotNull, InstantHandle] Func errorFactory, + bool treatWarningAsError = false) { Throw.IfArgumentNull(onSuccess, nameof(onSuccess)); Throw.IfArgumentNull(errorFactory, nameof(errorFactory)); @@ -211,10 +211,10 @@ public static CustomResult OnSuccess(in this Result result, /// If the is null. /// If the is null. [PublicAPI] - public static Result OnSuccess(in this Result result, - [NotNull, InstantHandle] in Func> onSuccess, - [NotNull] in TError errorObject, - in bool treatWarningAsError = false) + public static Result OnSuccess(this Result result, + [NotNull, InstantHandle] Func> onSuccess, + [NotNull] TError errorObject, + bool treatWarningAsError = false) { Throw.IfArgumentNull(onSuccess, nameof(onSuccess)); Throw.IfArgumentNull(errorObject, nameof(errorObject)); @@ -240,10 +240,10 @@ public static Result OnSuccess(in this Result result, /// If the is null. /// If the is null. [PublicAPI] - public static Result OnSuccess(in this Result result, - [NotNull, InstantHandle] in Func> onSuccess, - [NotNull, InstantHandle] in Func errorFactory, - in bool treatWarningAsError = false) + public static Result OnSuccess(this Result result, + [NotNull, InstantHandle] Func> onSuccess, + [NotNull, InstantHandle] Func errorFactory, + bool treatWarningAsError = false) { Throw.IfArgumentNull(onSuccess, nameof(onSuccess)); Throw.IfArgumentNull(errorFactory, nameof(errorFactory)); @@ -265,10 +265,10 @@ public static Result OnSuccess(in this Result result, /// An output value. /// If the is null. [PublicAPI] - public static TOut OnSuccess(in this Result result, - [NotNull, InstantHandle] in Func onSuccess, - [CanBeNull] in TOut defaultValue, - in bool treatWarningAsError = false) + public static TOut OnSuccess(this Result result, + [NotNull, InstantHandle] Func onSuccess, + [CanBeNull] TOut defaultValue, + bool treatWarningAsError = false) { Throw.IfArgumentNull(onSuccess, nameof(onSuccess)); @@ -290,10 +290,10 @@ public static TOut OnSuccess(in this Result result, /// If the is null. /// If the is null. [PublicAPI] - public static TOut OnSuccess(in this Result result, - [NotNull, InstantHandle] in Func onSuccess, - [NotNull, InstantHandle] in Func valueFactory, - in bool treatWarningAsError = false) + public static TOut OnSuccess(this Result result, + [NotNull, InstantHandle] Func onSuccess, + [NotNull, InstantHandle] Func valueFactory, + bool treatWarningAsError = false) { Throw.IfArgumentNull(onSuccess, nameof(onSuccess)); Throw.IfArgumentNull(valueFactory, nameof(valueFactory)); @@ -317,9 +317,9 @@ public static TOut OnSuccess(in this Result result, /// This . /// If the is null. [PublicAPI] - public static Result OnSuccess(in this Result result, - [NotNull, InstantHandle] in Action onSuccess, - in bool treatWarningAsError = false) + public static Result OnSuccess(this Result result, + [NotNull, InstantHandle] Action onSuccess, + bool treatWarningAsError = false) { Throw.IfArgumentNull(onSuccess, nameof(onSuccess)); @@ -340,9 +340,9 @@ public static Result OnSuccess(in this Result result, /// A . /// If the is null. [PublicAPI] - public static Result OnSuccess(in this Result result, - [NotNull, InstantHandle] in Func converter, - in bool treatWarningAsError = false) + public static Result OnSuccess(this Result result, + [NotNull, InstantHandle] Func converter, + bool treatWarningAsError = false) { Throw.IfArgumentNull(converter, nameof(converter)); @@ -362,9 +362,9 @@ public static Result OnSuccess(in this Result result, /// A resulting of , otherwise a failure. /// If the is null. [PublicAPI] - public static Result OnSuccess(in this Result result, - [NotNull, InstantHandle] in Func onSuccess, - in bool treatWarningAsError = false) + public static Result OnSuccess(this Result result, + [NotNull, InstantHandle] Func onSuccess, + bool treatWarningAsError = false) { Throw.IfArgumentNull(onSuccess, nameof(onSuccess)); @@ -388,9 +388,9 @@ public static Result OnSuccess(in this Result result, /// A resulting of , otherwise a failure. /// If the is null. [PublicAPI] - public static Result OnSuccess(in this Result result, - [NotNull, InstantHandle] in Func> onSuccess, - in bool treatWarningAsError = false) + public static Result OnSuccess(this Result result, + [NotNull, InstantHandle] Func> onSuccess, + bool treatWarningAsError = false) { Throw.IfArgumentNull(onSuccess, nameof(onSuccess)); @@ -415,10 +415,10 @@ public static Result OnSuccess(in this Result result, /// If the is null. /// If the is null. [PublicAPI] - public static CustomResult OnSuccess(in this Result result, - [NotNull, InstantHandle] in Func> onSuccess, - [NotNull] in TError errorObject, - in bool treatWarningAsError = false) + public static CustomResult OnSuccess(this Result result, + [NotNull, InstantHandle] Func> onSuccess, + [NotNull] TError errorObject, + bool treatWarningAsError = false) { Throw.IfArgumentNull(onSuccess, nameof(onSuccess)); Throw.IfArgumentNull(errorObject, nameof(errorObject)); @@ -444,10 +444,10 @@ public static CustomResult OnSuccess(in this Result result /// If the is null. /// If the is null. [PublicAPI] - public static CustomResult OnSuccess(in this Result result, - [NotNull, InstantHandle] in Func> onSuccess, - [NotNull, InstantHandle] in Func, TError> errorFactory, - in bool treatWarningAsError = false) + public static CustomResult OnSuccess(this Result result, + [NotNull, InstantHandle] Func> onSuccess, + [NotNull, InstantHandle] Func, TError> errorFactory, + bool treatWarningAsError = false) { Throw.IfArgumentNull(onSuccess, nameof(onSuccess)); Throw.IfArgumentNull(errorFactory, nameof(errorFactory)); @@ -474,10 +474,10 @@ public static CustomResult OnSuccess(in this Result result /// If the is null. /// If the is null. [PublicAPI] - public static Result OnSuccess(in this Result result, - [NotNull, InstantHandle] in Func> onSuccess, - [NotNull] in TError errorObject, - in bool treatWarningAsError = false) + public static Result OnSuccess(this Result result, + [NotNull, InstantHandle] Func> onSuccess, + [NotNull] TError errorObject, + bool treatWarningAsError = false) { Throw.IfArgumentNull(onSuccess, nameof(onSuccess)); Throw.IfArgumentNull(errorObject, nameof(errorObject)); @@ -504,10 +504,10 @@ public static Result OnSuccess(in this ResultIf the is null. /// If the is null. [PublicAPI] - public static Result OnSuccess(in this Result result, - [NotNull, InstantHandle] in Func> onSuccess, - [NotNull, InstantHandle] in Func, TError> errorFactory, - in bool treatWarningAsError = false) + public static Result OnSuccess(this Result result, + [NotNull, InstantHandle] Func> onSuccess, + [NotNull, InstantHandle] Func, TError> errorFactory, + bool treatWarningAsError = false) { Throw.IfArgumentNull(onSuccess, nameof(onSuccess)); Throw.IfArgumentNull(errorFactory, nameof(errorFactory)); @@ -530,10 +530,10 @@ public static Result OnSuccess(in this ResultAn output value. /// If the is null. [PublicAPI] - public static TOut OnSuccess(in this Result result, - [NotNull, InstantHandle] in Func, TOut> onSuccess, - [CanBeNull] in TOut defaultValue, - in bool treatWarningAsError = false) + public static TOut OnSuccess(this Result result, + [NotNull, InstantHandle] Func, TOut> onSuccess, + [CanBeNull] TOut defaultValue, + bool treatWarningAsError = false) { Throw.IfArgumentNull(onSuccess, nameof(onSuccess)); @@ -556,10 +556,10 @@ public static TOut OnSuccess(in this Result result, /// If the is null. /// If the is null. [PublicAPI] - public static TOut OnSuccess(in this Result result, - [NotNull, InstantHandle] in Func, TOut> onSuccess, - [NotNull, InstantHandle] in Func, TOut> valueFactory, - in bool treatWarningAsError = false) + public static TOut OnSuccess(this Result result, + [NotNull, InstantHandle] Func, TOut> onSuccess, + [NotNull, InstantHandle] Func, TOut> valueFactory, + bool treatWarningAsError = false) { Throw.IfArgumentNull(onSuccess, nameof(onSuccess)); Throw.IfArgumentNull(valueFactory, nameof(valueFactory)); @@ -583,9 +583,9 @@ public static TOut OnSuccess(in this Result result, /// This . /// If the is null. [PublicAPI] - public static CustomResult OnSuccess(in this CustomResult result, - [NotNull, InstantHandle] in Action onSuccess, - in bool treatWarningAsError = false) + public static CustomResult OnSuccess(this CustomResult result, + [NotNull, InstantHandle] Action onSuccess, + bool treatWarningAsError = false) { Throw.IfArgumentNull(onSuccess, nameof(onSuccess)); @@ -605,9 +605,9 @@ public static CustomResult OnSuccess(in this CustomResultThis . /// If the is null. [PublicAPI] - public static CustomResult OnSuccess(in this CustomResult result, - [NotNull, InstantHandle] in Action> onSuccess, - in bool treatWarningAsError = false) + public static CustomResult OnSuccess(this CustomResult result, + [NotNull, InstantHandle] Action> onSuccess, + bool treatWarningAsError = false) { Throw.IfArgumentNull(onSuccess, nameof(onSuccess)); @@ -630,10 +630,10 @@ public static CustomResult OnSuccess(in this CustomResultIf the is null. /// If the is null. [PublicAPI] - public static Result OnSuccess(in this CustomResult result, - [NotNull, InstantHandle] in Func, T> onSuccess, - [NotNull] in TError errorObject, - in bool treatWarningAsError = false) + public static Result OnSuccess(this CustomResult result, + [NotNull, InstantHandle] Func, T> onSuccess, + [NotNull] TError errorObject, + bool treatWarningAsError = false) { Throw.IfArgumentNull(onSuccess, nameof(onSuccess)); Throw.IfArgumentNull(errorObject, nameof(errorObject)); @@ -662,10 +662,10 @@ public static Result OnSuccess(in this CustomResultIf the is null. /// If the is null. [PublicAPI] - public static Result OnSuccess(in this CustomResult result, - [NotNull, InstantHandle] in Func, T> onSuccess, - [NotNull, InstantHandle] in Func, TError> errorFactory, - in bool treatWarningAsError = false) + public static Result OnSuccess(this CustomResult result, + [NotNull, InstantHandle] Func, T> onSuccess, + [NotNull, InstantHandle] Func, TError> errorFactory, + bool treatWarningAsError = false) { Throw.IfArgumentNull(onSuccess, nameof(onSuccess)); Throw.IfArgumentNull(errorFactory, nameof(errorFactory)); @@ -691,9 +691,9 @@ public static Result OnSuccess(in this CustomResultA resulting of , otherwise a failure. /// If the is null. [PublicAPI] - public static Result OnSuccess(in this CustomResult result, - [NotNull, InstantHandle] in Func, Result> onSuccess, - in bool treatWarningAsError = false) + public static Result OnSuccess(this CustomResult result, + [NotNull, InstantHandle] Func, Result> onSuccess, + bool treatWarningAsError = false) { Throw.IfArgumentNull(onSuccess, nameof(onSuccess)); @@ -717,9 +717,9 @@ public static Result OnSuccess(in this CustomResult result, /// A resulting of , otherwise a failure. /// If the is null. [PublicAPI] - public static Result OnSuccess(in this CustomResult result, - [NotNull, InstantHandle] in Func, Result> onSuccess, - in bool treatWarningAsError = false) + public static Result OnSuccess(this CustomResult result, + [NotNull, InstantHandle] Func, Result> onSuccess, + bool treatWarningAsError = false) { Throw.IfArgumentNull(onSuccess, nameof(onSuccess)); @@ -741,10 +741,10 @@ public static Result OnSuccess(in this CustomResult result /// If the is null. /// If the is null. [PublicAPI] - public static CustomResult OnSuccess(in this CustomResult result, - [NotNull, InstantHandle] in Func, CustomResult> onSuccess, - [NotNull] in TError errorObject, - in bool treatWarningAsError = false) + public static CustomResult OnSuccess(this CustomResult result, + [NotNull, InstantHandle] Func, CustomResult> onSuccess, + [NotNull] TError errorObject, + bool treatWarningAsError = false) { Throw.IfArgumentNull(onSuccess, nameof(onSuccess)); Throw.IfArgumentNull(errorObject, nameof(errorObject)); @@ -770,10 +770,10 @@ public static CustomResult OnSuccess(in this CustomResultIf the is null. /// If the is null. [PublicAPI] - public static CustomResult OnSuccess(in this CustomResult result, - [NotNull, InstantHandle] in Func, CustomResult> onSuccess, - [NotNull, InstantHandle] in Func, TError> errorFactory, - in bool treatWarningAsError = false) + public static CustomResult OnSuccess(this CustomResult result, + [NotNull, InstantHandle] Func, CustomResult> onSuccess, + [NotNull, InstantHandle] Func, TError> errorFactory, + bool treatWarningAsError = false) { Throw.IfArgumentNull(onSuccess, nameof(onSuccess)); Throw.IfArgumentNull(errorFactory, nameof(errorFactory)); @@ -800,10 +800,10 @@ public static CustomResult OnSuccess(in this CustomResultIf the is null. /// If the is null. [PublicAPI] - public static Result OnSuccess(in this CustomResult result, - [NotNull, InstantHandle] in Func, Result> onSuccess, - [NotNull] in TError errorObject, - in bool treatWarningAsError = false) + public static Result OnSuccess(this CustomResult result, + [NotNull, InstantHandle] Func, Result> onSuccess, + [NotNull] TError errorObject, + bool treatWarningAsError = false) { Throw.IfArgumentNull(onSuccess, nameof(onSuccess)); Throw.IfArgumentNull(errorObject, nameof(errorObject)); @@ -832,10 +832,10 @@ public static Result OnSuccess(in this CustomResultIf the is null. /// If the is null. [PublicAPI] - public static Result OnSuccess(in this CustomResult result, - [NotNull, InstantHandle] in Func, Result> onSuccess, - [NotNull, InstantHandle] in Func, TError> errorFactory, - in bool treatWarningAsError = false) + public static Result OnSuccess(this CustomResult result, + [NotNull, InstantHandle] Func, Result> onSuccess, + [NotNull, InstantHandle] Func, TError> errorFactory, + bool treatWarningAsError = false) { Throw.IfArgumentNull(onSuccess, nameof(onSuccess)); Throw.IfArgumentNull(errorFactory, nameof(errorFactory)); @@ -863,10 +863,10 @@ public static Result OnSuccess(in this CustomResultAn output value. /// If the is null. [PublicAPI] - public static TOut OnSuccess(in this CustomResult result, - [NotNull, InstantHandle] in Func, TOut> onSuccess, - [CanBeNull] in TOut defaultValue, - in bool treatWarningAsError = false) + public static TOut OnSuccess(this CustomResult result, + [NotNull, InstantHandle] Func, TOut> onSuccess, + [CanBeNull] TOut defaultValue, + bool treatWarningAsError = false) { Throw.IfArgumentNull(onSuccess, nameof(onSuccess)); @@ -889,10 +889,10 @@ public static TOut OnSuccess(in this CustomResult result, /// If the is null. /// If the is null. [PublicAPI] - public static TOut OnSuccess(in this CustomResult result, - [NotNull, InstantHandle] in Func, TOut> onSuccess, - [NotNull, InstantHandle] in Func, TOut> valueFactory, - in bool treatWarningAsError = false) + public static TOut OnSuccess(this CustomResult result, + [NotNull, InstantHandle] Func, TOut> onSuccess, + [NotNull, InstantHandle] Func, TOut> valueFactory, + bool treatWarningAsError = false) { Throw.IfArgumentNull(onSuccess, nameof(onSuccess)); Throw.IfArgumentNull(valueFactory, nameof(valueFactory)); @@ -917,9 +917,9 @@ public static TOut OnSuccess(in this CustomResult result, /// This . /// If the is null. [PublicAPI] - public static Result OnSuccess(in this Result result, - [NotNull, InstantHandle] in Action onSuccess, - in bool treatWarningAsError = false) + public static Result OnSuccess(this Result result, + [NotNull, InstantHandle] Action onSuccess, + bool treatWarningAsError = false) { Throw.IfArgumentNull(onSuccess, nameof(onSuccess)); @@ -943,10 +943,10 @@ public static Result OnSuccess(in this Result r /// If the is null. /// If the is null. [PublicAPI] - public static Result OnSuccess(in this Result result, - [NotNull, InstantHandle] in Func converter, - [NotNull] in TError errorObject, - in bool treatWarningAsError = false) + public static Result OnSuccess(this Result result, + [NotNull, InstantHandle] Func converter, + [NotNull] TError errorObject, + bool treatWarningAsError = false) { Throw.IfArgumentNull(converter, nameof(converter)); Throw.IfArgumentNull(errorObject, nameof(errorObject)); @@ -975,10 +975,10 @@ public static Result OnSuccess(in this ResultIf the is null. /// If the is null. [PublicAPI] - public static Result OnSuccess(in this Result result, - [NotNull, InstantHandle] in Func converter, - [NotNull, InstantHandle] in Func, TError> errorFactory, - in bool treatWarningAsError = false) + public static Result OnSuccess(this Result result, + [NotNull, InstantHandle] Func converter, + [NotNull, InstantHandle] Func, TError> errorFactory, + bool treatWarningAsError = false) { Throw.IfArgumentNull(converter, nameof(converter)); Throw.IfArgumentNull(errorFactory, nameof(errorFactory)); @@ -1004,9 +1004,9 @@ public static Result OnSuccess(in this ResultA resulting of , otherwise a failure. /// If the is null. [PublicAPI] - public static Result OnSuccess(in this Result result, - [NotNull, InstantHandle] in Func onSuccess, - in bool treatWarningAsError = false) + public static Result OnSuccess(this Result result, + [NotNull, InstantHandle] Func onSuccess, + bool treatWarningAsError = false) { Throw.IfArgumentNull(onSuccess, nameof(onSuccess)); @@ -1031,9 +1031,9 @@ public static Result OnSuccess(in this Result result, /// A resulting of , otherwise a failure. /// If the is null. [PublicAPI] - public static Result OnSuccess(in this Result result, - [NotNull, InstantHandle] in Func> onSuccess, - in bool treatWarningAsError = false) + public static Result OnSuccess(this Result result, + [NotNull, InstantHandle] Func> onSuccess, + bool treatWarningAsError = false) { Throw.IfArgumentNull(onSuccess, nameof(onSuccess)); @@ -1056,10 +1056,10 @@ public static Result OnSuccess(in this ResultIf the is null. /// If the is null. [PublicAPI] - public static CustomResult OnSuccess(in this Result result, - [NotNull, InstantHandle] in Func> onSuccess, - [NotNull] in TError errorObject, - in bool treatWarningAsError = false) + public static CustomResult OnSuccess(this Result result, + [NotNull, InstantHandle] Func> onSuccess, + [NotNull] TError errorObject, + bool treatWarningAsError = false) { Throw.IfArgumentNull(onSuccess, nameof(onSuccess)); Throw.IfArgumentNull(errorObject, nameof(errorObject)); @@ -1086,10 +1086,10 @@ public static CustomResult OnSuccess(in this ResultIf the is null. /// If the is null. [PublicAPI] - public static CustomResult OnSuccess(in this Result result, - [NotNull, InstantHandle] in Func> onSuccess, - [NotNull, InstantHandle] in Func, TError> errorFactory, - in bool treatWarningAsError = false) + public static CustomResult OnSuccess(this Result result, + [NotNull, InstantHandle] Func> onSuccess, + [NotNull, InstantHandle] Func, TError> errorFactory, + bool treatWarningAsError = false) { Throw.IfArgumentNull(onSuccess, nameof(onSuccess)); Throw.IfArgumentNull(errorFactory, nameof(errorFactory)); @@ -1117,10 +1117,10 @@ public static CustomResult OnSuccess(in this ResultIf the is null. /// If the is null. [PublicAPI] - public static Result OnSuccess(in this Result result, - [NotNull, InstantHandle] in Func> onSuccess, - [NotNull] in TError errorObject, - in bool treatWarningAsError = false) + public static Result OnSuccess(this Result result, + [NotNull, InstantHandle] Func> onSuccess, + [NotNull] TError errorObject, + bool treatWarningAsError = false) { Throw.IfArgumentNull(onSuccess, nameof(onSuccess)); Throw.IfArgumentNull(errorObject, nameof(errorObject)); @@ -1150,10 +1150,10 @@ public static Result OnSuccess(in this ResultIf the is null. /// If the is null. [PublicAPI] - public static Result OnSuccess(in this Result result, - [NotNull, InstantHandle] in Func> onSuccess, - [NotNull, InstantHandle] in Func, TError> errorFactory, - in bool treatWarningAsError = false) + public static Result OnSuccess(this Result result, + [NotNull, InstantHandle] Func> onSuccess, + [NotNull, InstantHandle] Func, TError> errorFactory, + bool treatWarningAsError = false) { Throw.IfArgumentNull(onSuccess, nameof(onSuccess)); Throw.IfArgumentNull(errorFactory, nameof(errorFactory)); @@ -1182,10 +1182,10 @@ public static Result OnSuccess(in this ResultAn output value. /// If the is null. [PublicAPI] - public static TOut OnSuccess(in this Result result, - [NotNull, InstantHandle] in Func, TOut> onSuccess, - [CanBeNull] in TOut defaultValue, - in bool treatWarningAsError = false) + public static TOut OnSuccess(this Result result, + [NotNull, InstantHandle] Func, TOut> onSuccess, + [CanBeNull] TOut defaultValue, + bool treatWarningAsError = false) { Throw.IfArgumentNull(onSuccess, nameof(onSuccess)); @@ -1209,10 +1209,10 @@ public static TOut OnSuccess(in this Result resu /// If the is null. /// If the is null. [PublicAPI] - public static TOut OnSuccess(in this Result result, - [NotNull, InstantHandle] in Func, TOut> onSuccess, - [NotNull, InstantHandle] in Func, TOut> valueFactory, - in bool treatWarningAsError = false) + public static TOut OnSuccess(this Result result, + [NotNull, InstantHandle] Func, TOut> onSuccess, + [NotNull, InstantHandle] Func, TOut> valueFactory, + bool treatWarningAsError = false) { Throw.IfArgumentNull(onSuccess, nameof(onSuccess)); Throw.IfArgumentNull(valueFactory, nameof(valueFactory)); diff --git a/src/Here/Result/Extensions/ResultExtensions_OnSuccessOrFailure.cs b/src/Here/Result/Extensions/ResultExtensions_OnSuccessOrFailure.cs index d434fb4..b4f93c7 100644 --- a/src/Here/Result/Extensions/ResultExtensions_OnSuccessOrFailure.cs +++ b/src/Here/Result/Extensions/ResultExtensions_OnSuccessOrFailure.cs @@ -22,10 +22,10 @@ public static partial class ResultExtensions /// If the is null. /// If the is null. [PublicAPI] - public static Result OnSuccessOrFailure(in this Result result, - [NotNull, InstantHandle] in Action onSuccess, - [NotNull, InstantHandle] in Action onFailure, - in bool treatWarningAsError = false) + public static Result OnSuccessOrFailure(this Result result, + [NotNull, InstantHandle] Action onSuccess, + [NotNull, InstantHandle] Action onFailure, + bool treatWarningAsError = false) { Throw.IfArgumentNull(onSuccess, nameof(onSuccess)); Throw.IfArgumentNull(onFailure, nameof(onFailure)); @@ -49,10 +49,10 @@ public static Result OnSuccessOrFailure(in this Result result, /// If the is null. /// If the is null. [PublicAPI] - public static Result OnSuccessOrFailure(in this Result result, - [NotNull, InstantHandle] in Action onSuccess, - [NotNull, InstantHandle] in Action onFailure, - in bool treatWarningAsError = false) + public static Result OnSuccessOrFailure(this Result result, + [NotNull, InstantHandle] Action onSuccess, + [NotNull, InstantHandle] Action onFailure, + bool treatWarningAsError = false) { Throw.IfArgumentNull(onSuccess, nameof(onSuccess)); Throw.IfArgumentNull(onFailure, nameof(onFailure)); @@ -76,10 +76,10 @@ public static Result OnSuccessOrFailure(in this Result result, /// If the is null. /// If the is null. [PublicAPI] - public static Result OnSuccessOrFailure(in this Result result, - [NotNull, InstantHandle] in Action onSuccess, - [NotNull, InstantHandle] in Action onFailure, - in bool treatWarningAsError = false) + public static Result OnSuccessOrFailure(this Result result, + [NotNull, InstantHandle] Action onSuccess, + [NotNull, InstantHandle] Action onFailure, + bool treatWarningAsError = false) { Throw.IfArgumentNull(onSuccess, nameof(onSuccess)); Throw.IfArgumentNull(onFailure, nameof(onFailure)); @@ -104,10 +104,10 @@ public static Result OnSuccessOrFailure(in this Result result, /// If the is null. /// If the is null. [PublicAPI] - public static TOut OnSuccessOrFailure(in this Result result, - [NotNull, InstantHandle] in Func onSuccess, - [NotNull, InstantHandle] in Func onFailure, - in bool treatWarningAsError = false) + public static TOut OnSuccessOrFailure(this Result result, + [NotNull, InstantHandle] Func onSuccess, + [NotNull, InstantHandle] Func onFailure, + bool treatWarningAsError = false) { Throw.IfArgumentNull(onSuccess, nameof(onSuccess)); Throw.IfArgumentNull(onFailure, nameof(onFailure)); @@ -134,10 +134,10 @@ public static TOut OnSuccessOrFailure(in this Result result, /// If the is null. /// If the is null. [PublicAPI] - public static Result OnSuccessOrFailure(in this Result result, - [NotNull, InstantHandle] in Action onSuccess, - [NotNull, InstantHandle] in Action onFailure, - in bool treatWarningAsError = false) + public static Result OnSuccessOrFailure(this Result result, + [NotNull, InstantHandle] Action onSuccess, + [NotNull, InstantHandle] Action onFailure, + bool treatWarningAsError = false) { Throw.IfArgumentNull(onSuccess, nameof(onSuccess)); Throw.IfArgumentNull(onFailure, nameof(onFailure)); @@ -162,10 +162,10 @@ public static Result OnSuccessOrFailure(in this Result result, /// If the is null. /// If the is null. [PublicAPI] - public static Result OnSuccessOrFailure(in this Result result, - [NotNull, InstantHandle] in Action> onSuccess, - [NotNull, InstantHandle] in Action> onFailure, - in bool treatWarningAsError = false) + public static Result OnSuccessOrFailure(this Result result, + [NotNull, InstantHandle] Action> onSuccess, + [NotNull, InstantHandle] Action> onFailure, + bool treatWarningAsError = false) { Throw.IfArgumentNull(onSuccess, nameof(onSuccess)); Throw.IfArgumentNull(onFailure, nameof(onFailure)); @@ -191,10 +191,10 @@ public static Result OnSuccessOrFailure(in this Result result, /// If the is null. /// If the is null. [PublicAPI] - public static TOut OnSuccessOrFailure(in this Result result, - [NotNull, InstantHandle] in Func, TOut> onSuccess, - [NotNull, InstantHandle] in Func, TOut> onFailure, - in bool treatWarningAsError = false) + public static TOut OnSuccessOrFailure(this Result result, + [NotNull, InstantHandle] Func, TOut> onSuccess, + [NotNull, InstantHandle] Func, TOut> onFailure, + bool treatWarningAsError = false) { Throw.IfArgumentNull(onSuccess, nameof(onSuccess)); Throw.IfArgumentNull(onFailure, nameof(onFailure)); @@ -221,10 +221,10 @@ public static TOut OnSuccessOrFailure(in this Result result, /// If the is null. /// If the is null. [PublicAPI] - public static CustomResult OnSuccessOrFailure(in this CustomResult result, - [NotNull, InstantHandle] in Action onSuccess, - [NotNull, InstantHandle] in Action onFailure, - in bool treatWarningAsError = false) + public static CustomResult OnSuccessOrFailure(this CustomResult result, + [NotNull, InstantHandle] Action onSuccess, + [NotNull, InstantHandle] Action onFailure, + bool treatWarningAsError = false) { Throw.IfArgumentNull(onSuccess, nameof(onSuccess)); Throw.IfArgumentNull(onFailure, nameof(onFailure)); @@ -249,10 +249,10 @@ public static CustomResult OnSuccessOrFailure(in this CustomResu /// If the is null. /// If the is null. [PublicAPI] - public static CustomResult OnSuccessOrFailure(in this CustomResult result, - [NotNull, InstantHandle] in Action onSuccess, - [NotNull, InstantHandle] in Action> onFailure, - in bool treatWarningAsError = false) + public static CustomResult OnSuccessOrFailure(this CustomResult result, + [NotNull, InstantHandle] Action onSuccess, + [NotNull, InstantHandle] Action> onFailure, + bool treatWarningAsError = false) { Throw.IfArgumentNull(onSuccess, nameof(onSuccess)); Throw.IfArgumentNull(onFailure, nameof(onFailure)); @@ -277,10 +277,10 @@ public static CustomResult OnSuccessOrFailure(in this CustomResu /// If the is null. /// If the is null. [PublicAPI] - public static CustomResult OnSuccessOrFailure(in this CustomResult result, - [NotNull, InstantHandle] in Action> onSuccess, - [NotNull, InstantHandle] in Action> onFailure, - in bool treatWarningAsError = false) + public static CustomResult OnSuccessOrFailure(this CustomResult result, + [NotNull, InstantHandle] Action> onSuccess, + [NotNull, InstantHandle] Action> onFailure, + bool treatWarningAsError = false) { Throw.IfArgumentNull(onSuccess, nameof(onSuccess)); Throw.IfArgumentNull(onFailure, nameof(onFailure)); @@ -306,10 +306,10 @@ public static CustomResult OnSuccessOrFailure(in this CustomResu /// If the is null. /// If the is null. [PublicAPI] - public static TOut OnSuccessOrFailure(in this CustomResult result, - [NotNull, InstantHandle] in Func, TOut> onSuccess, - [NotNull, InstantHandle] in Func, TOut> onFailure, - in bool treatWarningAsError = false) + public static TOut OnSuccessOrFailure(this CustomResult result, + [NotNull, InstantHandle] Func, TOut> onSuccess, + [NotNull, InstantHandle] Func, TOut> onFailure, + bool treatWarningAsError = false) { Throw.IfArgumentNull(onSuccess, nameof(onSuccess)); Throw.IfArgumentNull(onFailure, nameof(onFailure)); @@ -337,10 +337,10 @@ public static TOut OnSuccessOrFailure(in this CustomResult /// If the is null. /// If the is null. [PublicAPI] - public static Result OnSuccessOrFailure(in this Result result, - [NotNull, InstantHandle] in Action onSuccess, - [NotNull, InstantHandle] in Action onFailure, - in bool treatWarningAsError = false) + public static Result OnSuccessOrFailure(this Result result, + [NotNull, InstantHandle] Action onSuccess, + [NotNull, InstantHandle] Action onFailure, + bool treatWarningAsError = false) { Throw.IfArgumentNull(onSuccess, nameof(onSuccess)); Throw.IfArgumentNull(onFailure, nameof(onFailure)); @@ -366,10 +366,10 @@ public static Result OnSuccessOrFailure(in this ResultIf the is null. /// If the is null. [PublicAPI] - public static Result OnSuccessOrFailure(in this Result result, - [NotNull, InstantHandle] in Action> onSuccess, - [NotNull, InstantHandle] in Action> onFailure, - in bool treatWarningAsError = false) + public static Result OnSuccessOrFailure(this Result result, + [NotNull, InstantHandle] Action> onSuccess, + [NotNull, InstantHandle] Action> onFailure, + bool treatWarningAsError = false) { Throw.IfArgumentNull(onSuccess, nameof(onSuccess)); Throw.IfArgumentNull(onFailure, nameof(onFailure)); @@ -396,10 +396,10 @@ public static Result OnSuccessOrFailure(in this ResultIf the is null. /// If the is null. [PublicAPI] - public static TOut OnSuccessOrFailure(in this Result result, - [NotNull, InstantHandle] in Func, TOut> onSuccess, - [NotNull, InstantHandle] in Func, TOut> onFailure, - in bool treatWarningAsError = false) + public static TOut OnSuccessOrFailure(this Result result, + [NotNull, InstantHandle] Func, TOut> onSuccess, + [NotNull, InstantHandle] Func, TOut> onFailure, + bool treatWarningAsError = false) { Throw.IfArgumentNull(onSuccess, nameof(onSuccess)); Throw.IfArgumentNull(onFailure, nameof(onFailure)); diff --git a/src/Here/Result/Extensions/ResultOperatorsExtensions.cs b/src/Here/Result/Extensions/ResultOperatorsExtensions.cs index 3626621..5e55f6f 100644 --- a/src/Here/Result/Extensions/ResultOperatorsExtensions.cs +++ b/src/Here/Result/Extensions/ResultOperatorsExtensions.cs @@ -15,7 +15,7 @@ public static class ResultOperatorsExtensions /// /// to convert. /// An . - public static Option ToOption(in this Result result) + public static Option ToOption(this Result result) { return Option.Some(result.Logic.IsSuccess); } @@ -26,7 +26,7 @@ public static Option ToOption(in this Result result) /// Type of the result value. /// to convert. /// An . - public static Option ToOption(in this Result result) + public static Option ToOption(this Result result) { if (result.Logic.IsSuccess) return result._value; @@ -39,7 +39,7 @@ public static Option ToOption(in this Result result) /// Error type of the result. /// to convert. /// An . - public static Option ToOption(in this CustomResult result) + public static Option ToOption(this CustomResult result) { return Option.Some(result.Logic.IsSuccess); } @@ -51,7 +51,7 @@ public static Option ToOption(in this CustomResult result) /// Error type of the result. /// to convert. /// An . - public static Option ToOption(in this Result result) + public static Option ToOption(this Result result) { if (result.Logic.IsSuccess) return result._value; @@ -68,7 +68,7 @@ public static Option ToOption(in this Result result) /// Type of the result value. /// to convert. /// An . - public static Either ToEither(in this Result result) + public static Either ToEither(this Result result) { if (result.IsSuccess) { @@ -87,7 +87,7 @@ public static Either ToEither(in this Result result) /// Error type of the result. /// to convert. /// An . - public static Either ToMessageEither(in this Result result) + public static Either ToMessageEither(this Result result) { if (result.IsSuccess) { @@ -106,7 +106,7 @@ public static Either ToMessageEither(in this ResultError type of the result. /// to convert. /// An . - public static Either ToEither(in this Result result) + public static Either ToEither(this Result result) { if (result.IsSuccess) { diff --git a/src/Here/Result/Result.Implicit.cs b/src/Here/Result/Result.Implicit.cs index 9e904f2..9c68ee1 100644 --- a/src/Here/Result/Result.Implicit.cs +++ b/src/Here/Result/Result.Implicit.cs @@ -12,7 +12,7 @@ public partial struct Result /// to convert. /// An . [PublicAPI, Pure] - public static implicit operator Option(in Result result) + public static implicit operator Option(Result result) { return result.ToOption(); } @@ -26,7 +26,7 @@ public partial struct Result /// to convert. /// A . [PublicAPI, Pure] - public static implicit operator Result(in Result result) + public static implicit operator Result(Result result) { return new Result(result.Logic); } @@ -37,7 +37,7 @@ public static implicit operator Result(in Result result) /// to convert. /// An . [PublicAPI, Pure] - public static implicit operator Option(in Result result) + public static implicit operator Option(Result result) { return result.ToOption(); } @@ -51,7 +51,7 @@ public partial struct CustomResult /// to convert. /// A . [PublicAPI, Pure] - public static implicit operator Result(in CustomResult result) + public static implicit operator Result(CustomResult result) { return new Result(ResultLogic.ToResultLogic(result.Logic)); } @@ -62,7 +62,7 @@ public static implicit operator Result(in CustomResult result) /// to convert. /// An . [PublicAPI, Pure] - public static implicit operator Option(in CustomResult result) + public static implicit operator Option(CustomResult result) { return result.ToOption(); } @@ -76,7 +76,7 @@ public partial struct Result /// to convert. /// A . [PublicAPI, Pure] - public static implicit operator Result(in Result result) + public static implicit operator Result(Result result) { return new Result(ResultLogic.ToResultLogic(result.Logic)); } @@ -87,7 +87,7 @@ public static implicit operator Result(in Result result) /// to convert. /// A . [PublicAPI, Pure] - public static implicit operator CustomResult(in Result result) + public static implicit operator CustomResult(Result result) { return new CustomResult(result.Logic); } @@ -98,10 +98,10 @@ public static implicit operator CustomResult(in Result result /// to convert. /// A . [PublicAPI, Pure] - public static implicit operator Result(in Result result) + public static implicit operator Result(Result result) { return new Result( - result.IsSuccess ? result.Value : default, + result.IsSuccess ? result.Value : default(T), ResultLogic.ToResultLogic(result.Logic)); } @@ -111,7 +111,7 @@ public static implicit operator Result(in Result result) /// to convert. /// An . [PublicAPI, Pure] - public static implicit operator Option(in Result result) + public static implicit operator Option(Result result) { return result.ToOption(); } diff --git a/src/Here/Result/Result.cs b/src/Here/Result/Result.cs index 35caf40..0d7eb1d 100644 --- a/src/Here/Result/Result.cs +++ b/src/Here/Result/Result.cs @@ -9,7 +9,7 @@ namespace Here /// [PublicAPI] [DebuggerDisplay("{" + nameof(IsSuccess) + " ? \"IsSuccess\" + (" + nameof(IsWarning) + " ? \" with warning\" : System.String.Empty) : \"IsFailure\"}")] - public readonly partial struct Result : IResult, IEquatable, IComparable, IComparable + public partial struct Result : IResult, IEquatable, IComparable, IComparable { /// /// A success . @@ -40,7 +40,7 @@ namespace Here /// constructor. /// /// Result logic. - internal Result([NotNull] in ResultLogic logic) + internal Result([NotNull] ResultLogic logic) { Logic = logic; } @@ -51,7 +51,7 @@ internal Result([NotNull] in ResultLogic logic) /// Result warning flag. /// Result message. /// Result embedded exception. - private Result(in bool isWarning, [NotNull] in string message, [CanBeNull] in Exception exception) + private Result(bool isWarning, [NotNull] string message, [CanBeNull] Exception exception) { Logic = new ResultLogic(isWarning, message, exception); } @@ -65,7 +65,7 @@ private Result(in bool isWarning, [NotNull] in string message, [CanBeNull] in Ex /// Value. /// A . [PublicAPI, Pure] - public Result Cast([CanBeNull] in T value) + public Result Cast([CanBeNull] T value) { if (IsFailure) return ToFailValueResult(); @@ -80,7 +80,7 @@ public Result Cast([CanBeNull] in T value) /// A . /// If the is null. [PublicAPI, Pure] - public Result Cast([NotNull, InstantHandle] in Func valueFactory) + public Result Cast([NotNull, InstantHandle] Func valueFactory) { Throw.IfArgumentNull(valueFactory, nameof(valueFactory)); @@ -97,7 +97,7 @@ public Result Cast([NotNull, InstantHandle] in Func valueFactory) /// A . /// If the is null. [PublicAPI, Pure] - public CustomResult CustomCast([NotNull] in TError errorObject) + public CustomResult CustomCast([NotNull] TError errorObject) { Throw.IfArgumentNull(errorObject, nameof(errorObject)); @@ -116,7 +116,7 @@ public CustomResult CustomCast([NotNull] in TError errorObject) /// A . /// If the is null. [PublicAPI, Pure] - public CustomResult CustomCast([NotNull, InstantHandle] in Func errorFactory) + public CustomResult CustomCast([NotNull, InstantHandle] Func errorFactory) { Throw.IfArgumentNull(errorFactory, nameof(errorFactory)); @@ -137,7 +137,7 @@ public CustomResult CustomCast([NotNull, InstantHandle] in Func< /// A . /// If the is null. [PublicAPI, Pure] - public Result Cast([CanBeNull] in T value, [NotNull] in TError errorObject) + public Result Cast([CanBeNull] T value, [NotNull] TError errorObject) { Throw.IfArgumentNull(errorObject, nameof(errorObject)); @@ -158,7 +158,7 @@ public Result Cast([CanBeNull] in T value, [NotNull] in TE /// A . /// If the is null. [PublicAPI, Pure] - public Result Cast([CanBeNull] in T value, [NotNull, InstantHandle] in Func errorFactory) + public Result Cast([CanBeNull] T value, [NotNull, InstantHandle] Func errorFactory) { Throw.IfArgumentNull(errorFactory, nameof(errorFactory)); @@ -180,7 +180,7 @@ public Result Cast([CanBeNull] in T value, [NotNull, Insta /// If the is null. /// If the is null. [PublicAPI, Pure] - public Result Cast([NotNull, InstantHandle] in Func valueFactory, [NotNull] in TError errorObject) + public Result Cast([NotNull, InstantHandle] Func valueFactory, [NotNull] TError errorObject) { Throw.IfArgumentNull(valueFactory, nameof(valueFactory)); Throw.IfArgumentNull(errorObject, nameof(errorObject)); @@ -203,7 +203,7 @@ public Result Cast([NotNull, InstantHandle] in Func val /// If the is null. /// If the is null. [PublicAPI, Pure] - public Result Cast([NotNull, InstantHandle] in Func valueFactory, [NotNull, InstantHandle] in Func errorFactory) + public Result Cast([NotNull, InstantHandle] Func valueFactory, [NotNull, InstantHandle] Func errorFactory) { Throw.IfArgumentNull(valueFactory, nameof(valueFactory)); Throw.IfArgumentNull(errorFactory, nameof(errorFactory)); @@ -245,7 +245,7 @@ internal Result ToFailResult() /// Exception to set in the failure . /// A failed . [Pure] - internal Result ToFailResult([NotNull] in string additionalMessage, [CanBeNull] in Exception exception = null) + internal Result ToFailResult([NotNull] string additionalMessage, [CanBeNull] Exception exception = null) { Debug.Assert(ResultLogic.IsConvertibleToFailure(Logic), "Cannot convert a success Result to a Result failure."); return Fail(Logic.Message + additionalMessage, exception); @@ -270,7 +270,7 @@ internal Result ToFailValueResult() /// Error object to use. /// A failed . [Pure] - internal CustomResult ToFailCustomResult([NotNull] in TError errorObject) + internal CustomResult ToFailCustomResult([NotNull] TError errorObject) { Debug.Assert(ResultLogic.IsConvertibleToFailure(Logic), "Cannot convert a success Result to a CustomResult failure."); return CustomFail(Logic.Message, errorObject, Logic.Exception); @@ -283,7 +283,7 @@ internal CustomResult ToFailCustomResult([NotNull] in TError err /// Error object to use. /// A failed . [Pure] - internal Result ToFailValueCustomResult([NotNull] in TError errorObject) + internal Result ToFailValueCustomResult([NotNull] TError errorObject) { Debug.Assert(ResultLogic.IsConvertibleToFailure(Logic), "Cannot convert a success Result to a Result failure."); return Fail(Logic.Message, errorObject, Logic.Exception); @@ -297,7 +297,7 @@ internal Result ToFailValueCustomResult([NotNull] in TErro /// Exception to set in the warning . /// A warning . [Pure] - internal Result ToWarnResult([NotNull] in string message, [CanBeNull] in Exception exception = null) + internal Result ToWarnResult([NotNull] string message, [CanBeNull] Exception exception = null) { Debug.Assert(ResultLogic.IsConvertibleToWarning(Logic), "Cannot convert a warning Result to a Result warning."); return Warn(message, exception); @@ -313,7 +313,7 @@ internal Result ToWarnResult([NotNull] in string message, [CanBeNull] in Excepti /// to compare. /// True if both are equal and successful, otherwise false. [PublicAPI, Pure] - public bool SuccessEquals(in Result other) + public bool SuccessEquals(Result other) { if (IsSuccess && other.IsSuccess) return Equals(other); @@ -340,7 +340,7 @@ public override bool Equals(object obj) /// First to compare. /// Second to compare. /// True if both are equal, otherwise false. - public static bool operator ==(in Result result1, in Result result2) + public static bool operator ==(Result result1, Result result2) { return result1.Equals(result2); } @@ -351,7 +351,7 @@ public override bool Equals(object obj) /// First to compare. /// Second to compare. /// True if both are not equal, otherwise false. - public static bool operator !=(in Result result1, in Result result2) + public static bool operator !=(Result result1, Result result2) { return !(result1 == result2); } @@ -393,7 +393,7 @@ public int CompareTo(Result other) /// The first to compare. /// The second to compare. /// The comparison result. - public static bool operator <(in Result left, in Result right) + public static bool operator <(Result left, Result right) { return left.CompareTo(right) < 0; } @@ -404,7 +404,7 @@ public int CompareTo(Result other) /// The first to compare. /// The second to compare. /// The comparison result. - public static bool operator <=(in Result left, in Result right) + public static bool operator <=(Result left, Result right) { return left.CompareTo(right) <= 0; } @@ -415,7 +415,7 @@ public int CompareTo(Result other) /// The first to compare. /// The second to compare. /// The comparison result. - public static bool operator >(in Result left, in Result right) + public static bool operator >(Result left, Result right) { return left.CompareTo(right) > 0; } @@ -426,7 +426,7 @@ public int CompareTo(Result other) /// The first to compare. /// The second to compare. /// The comparison result. - public static bool operator >=(in Result left, in Result right) + public static bool operator >=(Result left, Result right) { return left.CompareTo(right) >= 0; } @@ -458,7 +458,7 @@ public static Result Ok() /// If the is null or empty. [PublicAPI, Pure] [ContractAnnotation("message:null => halt")] - public static Result Warn([NotNull] in string message, [CanBeNull] in Exception exception = null) + public static Result Warn([NotNull] string message, [CanBeNull] Exception exception = null) { return new Result(true, message, exception); } @@ -472,7 +472,7 @@ public static Result Warn([NotNull] in string message, [CanBeNull] in Exception /// If the is null or empty. [PublicAPI, Pure] [ContractAnnotation("error:null => halt")] - public static Result Fail([NotNull] in string error, [CanBeNull] in Exception exception = null) + public static Result Fail([NotNull] string error, [CanBeNull] Exception exception = null) { return new Result(false, error, exception); } @@ -485,7 +485,7 @@ public static Result Fail([NotNull] in string error, [CanBeNull] in Exception ex /// If the is null. [PublicAPI, Pure] [ContractAnnotation("exception:null => halt")] - public static Result Fail([NotNull] in Exception exception) + public static Result Fail([NotNull] Exception exception) { Throw.IfArgumentNull(exception, nameof(exception)); @@ -502,7 +502,7 @@ public static Result Fail([NotNull] in Exception exception) /// Result value. /// A . [PublicAPI, Pure] - public static Result Ok([CanBeNull] in T value) + public static Result Ok([CanBeNull] T value) { return new Result(value); } @@ -517,7 +517,7 @@ public static Result Ok([CanBeNull] in T value) /// If the is null or empty. [PublicAPI, Pure] [ContractAnnotation("message:null => halt")] - public static Result Warn([CanBeNull] in T value, [NotNull] in string message, [CanBeNull] in Exception exception = null) + public static Result Warn([CanBeNull] T value, [NotNull] string message, [CanBeNull] Exception exception = null) { return new Result(true, value, message, exception); } @@ -531,9 +531,9 @@ public static Result Warn([CanBeNull] in T value, [NotNull] in string mess /// If the is null or empty. [PublicAPI, Pure] [ContractAnnotation("error:null => halt")] - public static Result Fail([NotNull] in string error, [CanBeNull] in Exception exception = null) + public static Result Fail([NotNull] string error, [CanBeNull] Exception exception = null) { - return new Result(false, default, error, exception); + return new Result(false, default(T), error, exception); } /// @@ -544,11 +544,11 @@ public static Result Fail([NotNull] in string error, [CanBeNull] in Except /// If the is null. [PublicAPI, Pure] [ContractAnnotation("exception:null => halt")] - public static Result Fail([NotNull] in Exception exception) + public static Result Fail([NotNull] Exception exception) { Throw.IfArgumentNull(exception, nameof(exception)); - return new Result(false, default, exception.Message, exception); + return new Result(false, default(T), exception.Message, exception); } #endregion @@ -574,9 +574,9 @@ public static CustomResult CustomOk() /// If the is null or empty. [PublicAPI, Pure] [ContractAnnotation("message:null => halt")] - public static CustomResult CustomWarn([NotNull] in string message, [CanBeNull] in Exception exception = null) + public static CustomResult CustomWarn([NotNull] string message, [CanBeNull] Exception exception = null) { - return new CustomResult(true, message, default, exception); + return new CustomResult(true, message, default(TError), exception); } /// @@ -590,7 +590,7 @@ public static CustomResult CustomWarn([NotNull] in string messag /// If the is null. [PublicAPI, Pure] [ContractAnnotation("message:null => halt; error:null => halt")] - public static CustomResult CustomFail([NotNull] in string message, [NotNull] in TError error, [CanBeNull] in Exception exception = null) + public static CustomResult CustomFail([NotNull] string message, [NotNull] TError error, [CanBeNull] Exception exception = null) { return new CustomResult(false, message, error, exception); } @@ -605,7 +605,7 @@ public static CustomResult CustomFail([NotNull] in string messag /// If the is null. [PublicAPI, Pure] [ContractAnnotation("error:null => halt; exception:null => halt")] - public static CustomResult CustomFail([NotNull] in TError error, [NotNull] in Exception exception) + public static CustomResult CustomFail([NotNull] TError error, [NotNull] Exception exception) { Throw.IfArgumentNull(exception, nameof(exception)); @@ -622,7 +622,7 @@ public static CustomResult CustomFail([NotNull] in TError error, /// Result value. /// A . [PublicAPI, Pure] - public static Result Ok([CanBeNull] in T value) + public static Result Ok([CanBeNull] T value) { return new Result(value); } @@ -637,7 +637,7 @@ public static Result Ok([CanBeNull] in T value) /// If the is null or empty. [PublicAPI, Pure] [ContractAnnotation("message:null => halt")] - public static Result Warn([CanBeNull] in T value, [NotNull] in string message, [CanBeNull] in Exception exception = null) + public static Result Warn([CanBeNull] T value, [NotNull] string message, [CanBeNull] Exception exception = null) { return new Result(value, message, exception); } @@ -653,7 +653,7 @@ public static Result Warn([CanBeNull] in T value, [NotNull /// If the is null. [PublicAPI, Pure] [ContractAnnotation("message:null => halt; error:null => halt")] - public static Result Fail([NotNull] in string message, [NotNull] in TError error, [CanBeNull] in Exception exception = null) + public static Result Fail([NotNull] string message, [NotNull] TError error, [CanBeNull] Exception exception = null) { return new Result(message, error, exception); } @@ -668,7 +668,7 @@ public static Result Fail([NotNull] in string message, [No /// If the is null. [PublicAPI, Pure] [ContractAnnotation("error:null => halt; exception:null => halt")] - public static Result Fail([NotNull] in TError error, [NotNull] in Exception exception) + public static Result Fail([NotNull] TError error, [NotNull] Exception exception) { Throw.IfArgumentNull(exception, nameof(exception)); diff --git a/src/Here/Result/ResultHelpers.cs b/src/Here/Result/ResultHelpers.cs index 571f567..057d467 100644 --- a/src/Here/Result/ResultHelpers.cs +++ b/src/Here/Result/ResultHelpers.cs @@ -18,7 +18,7 @@ public static class ResultHelpers /// Second to compare. /// True if both are equal, otherwise false. [PublicAPI, Pure] - public static bool AreEqual(in Result result1, in Result result2) + public static bool AreEqual(Result result1, Result result2) { return result1.Equals(result2); } @@ -32,7 +32,7 @@ public static bool AreEqual(in Result result1, in Result result2) /// Equality comparer to use to compare values. /// True if both are equal, otherwise false. [PublicAPI, Pure] - public static bool AreEqual(in Result result1, in Result result2, [CanBeNull] in IEqualityComparer equalityComparer = null) + public static bool AreEqual(Result result1, Result result2, [CanBeNull] IEqualityComparer equalityComparer = null) { return Result.AreEqual(result1, result2, equalityComparer); } @@ -46,7 +46,7 @@ public static bool AreEqual(in Result result1, in Result result2, [CanB /// Equality comparer to use to compare values. /// True if the value is equals to the given value, otherwise false. [PublicAPI, Pure] - public static bool AreEqual(in Result result, [CanBeNull] in T value, [CanBeNull] in IEqualityComparer equalityComparer = null) + public static bool AreEqual(Result result, [CanBeNull] T value, [CanBeNull] IEqualityComparer equalityComparer = null) { return Result.AreEqual(result, value, equalityComparer); } @@ -59,7 +59,7 @@ public static bool AreEqual(in Result result, [CanBeNull] in T value, [Can /// Second to compare. /// True if both are equal, otherwise false. [PublicAPI, Pure] - public static bool AreEqual(in CustomResult result1, in CustomResult result2) + public static bool AreEqual(CustomResult result1, CustomResult result2) { return result1.Equals(result2); } @@ -74,7 +74,7 @@ public static bool AreEqual(in CustomResult result1, in CustomRe /// Equality comparer to use to compare values. /// True if both are equal, otherwise false. [PublicAPI, Pure] - public static bool AreEqual(in Result result1, in Result result2, [CanBeNull] in IEqualityComparer equalityComparer = null) + public static bool AreEqual(Result result1, Result result2, [CanBeNull] IEqualityComparer equalityComparer = null) { return Result.AreEqual(result1, result2); } @@ -89,7 +89,7 @@ public static bool AreEqual(in Result result1, in ResultEquality comparer to use to compare values. /// True if the value is equals to the given value, otherwise false. [PublicAPI, Pure] - public static bool AreEqual(in Result result, [CanBeNull] in T value, [CanBeNull] in IEqualityComparer equalityComparer = null) + public static bool AreEqual(Result result, [CanBeNull] T value, [CanBeNull] IEqualityComparer equalityComparer = null) { return Result.AreEqual(result, value, equalityComparer); } @@ -105,7 +105,7 @@ public static bool AreEqual(in Result result, [CanBeNull] /// Second to compare. /// True if both are equal and successful, otherwise false. [PublicAPI, Pure] - public static bool SuccessEqual(in Result result1, in Result result2) + public static bool SuccessEqual(Result result1, Result result2) { return result1.SuccessEquals(result2); } @@ -119,7 +119,7 @@ public static bool SuccessEqual(in Result result1, in Result result2) /// Equality comparer to use to compare values. /// True if both are equal and successful, otherwise false. [PublicAPI, Pure] - public static bool SuccessEqual(in Result result1, in Result result2, [CanBeNull] in IEqualityComparer equalityComparer = null) + public static bool SuccessEqual(Result result1, Result result2, [CanBeNull] IEqualityComparer equalityComparer = null) { return Result.AreSuccessEqual(result1, result2, equalityComparer); } @@ -132,7 +132,7 @@ public static bool SuccessEqual(in Result result1, in Result result2, [ /// Second to compare. /// True if both are equal and successful, otherwise false. [PublicAPI, Pure] - public static bool SuccessEqual(in CustomResult result1, in CustomResult result2) + public static bool SuccessEqual(CustomResult result1, CustomResult result2) { return result1.SuccessEquals(result2); } @@ -147,7 +147,7 @@ public static bool SuccessEqual(in CustomResult result1, in Cust /// Equality comparer to use to compare values. /// True if both are equal and successful, otherwise false. [PublicAPI, Pure] - public static bool SuccessEqual(in Result result1, in Result result2, [CanBeNull] in IEqualityComparer equalityComparer = null) + public static bool SuccessEqual(Result result1, Result result2, [CanBeNull] IEqualityComparer equalityComparer = null) { return Result.AreSuccessEqual(result1, result2, equalityComparer); } @@ -164,7 +164,7 @@ public static bool SuccessEqual(in Result result1, in Resu /// Second to compare. /// An integer that indicates the relative order of compared objects. [PublicAPI, Pure] - public static int Compare(in Result result1, in Result result2) + public static int Compare(Result result1, Result result2) { return result1.CompareTo(result2); } @@ -178,7 +178,7 @@ public static int Compare(in Result result1, in Result result2) /// Second to compare. /// An integer that indicates the relative order of compared objects. [PublicAPI, Pure] - public static int Compare(in Result result1, in Result result2) + public static int Compare(Result result1, Result result2) { return result1.CompareTo(result2); } @@ -192,7 +192,7 @@ public static int Compare(in Result result1, in Result result2) /// Second to compare. /// An integer that indicates the relative order of compared objects. [PublicAPI, Pure] - public static int Compare(in CustomResult result1, in CustomResult result2) + public static int Compare(CustomResult result1, CustomResult result2) { return result1.CompareTo(result2); } @@ -207,7 +207,7 @@ public static int Compare(in CustomResult result1, in CustomResu /// Second to compare. /// An integer that indicates the relative order of compared objects. [PublicAPI, Pure] - public static int Compare(in Result result1, in Result result2) + public static int Compare(Result result1, Result result2) { return result1.CompareTo(result2); } diff --git a/src/Here/Result/ResultLogics.cs b/src/Here/Result/ResultLogics.cs index 88bb4bb..bdc41f1 100644 --- a/src/Here/Result/ResultLogics.cs +++ b/src/Here/Result/ResultLogics.cs @@ -60,7 +60,7 @@ public ResultLogic() IsWarning = false; IsFailure = false; Message = null; - _error = default; + _error = default(TError); Exception = null; } @@ -71,7 +71,7 @@ public ResultLogic() /// Message. /// Error object. /// Result embedded exception. - public ResultLogic(in bool isWarning, [NotNull] in string message, [CanBeNull] in TError error, [CanBeNull] in Exception exception) + public ResultLogic(bool isWarning, [NotNull] string message, [CanBeNull] TError error, [CanBeNull] Exception exception) { // Warning & Failure must have a message if (string.IsNullOrEmpty(message)) @@ -125,7 +125,7 @@ public override int GetHashCode() /// First to compare. /// Second to compare. /// True if both are equal, otherwise false. - public static bool operator ==(in ResultLogic result1, in ResultLogic result2) + public static bool operator ==(ResultLogic result1, ResultLogic result2) { if (ReferenceEquals(result1, result2)) return true; @@ -138,7 +138,7 @@ public override int GetHashCode() /// First to compare. /// Second to compare. /// True if both are not equal, otherwise false. - public static bool operator !=(in ResultLogic result1, in ResultLogic result2) + public static bool operator !=(ResultLogic result1, ResultLogic result2) { return !(result1 == result2); } @@ -179,7 +179,7 @@ public int CompareTo(ResultLogic other) /// The first to compare. /// The second to compare. /// The comparison result. - public static bool operator <(in ResultLogic left, in ResultLogic right) + public static bool operator <(ResultLogic left, ResultLogic right) { return left.CompareTo(right) < 0; } @@ -190,7 +190,7 @@ public int CompareTo(ResultLogic other) /// The first to compare. /// The second to compare. /// The comparison result. - public static bool operator <=(in ResultLogic left, in ResultLogic right) + public static bool operator <=(ResultLogic left, ResultLogic right) { return left.CompareTo(right) <= 0; } @@ -201,7 +201,7 @@ public int CompareTo(ResultLogic other) /// The first to compare. /// The second to compare. /// The comparison result. - public static bool operator >(in ResultLogic left, in ResultLogic right) + public static bool operator >(ResultLogic left, ResultLogic right) { return left.CompareTo(right) > 0; } @@ -212,7 +212,7 @@ public int CompareTo(ResultLogic other) /// The first to compare. /// The second to compare. /// The comparison result. - public static bool operator >=(in ResultLogic left, in ResultLogic right) + public static bool operator >=(ResultLogic left, ResultLogic right) { return left.CompareTo(right) >= 0; } @@ -248,7 +248,7 @@ public ResultLogic() /// Warning flag. /// Result message. /// Result embedded exception. - public ResultLogic(in bool isWarning, [NotNull] in string message, [CanBeNull] in Exception exception) + public ResultLogic(bool isWarning, [NotNull] string message, [CanBeNull] Exception exception) : base(isWarning, message, isWarning ? null : message, exception) { } @@ -261,7 +261,7 @@ public ResultLogic(in bool isWarning, [NotNull] in string message, [CanBeNull] i /// to check. /// True if the is convertible, otherwise false. [Pure] - internal static bool IsConvertibleToFailure(in ResultLogic logic) + internal static bool IsConvertibleToFailure(ResultLogic logic) { return !logic.IsSuccess || logic.IsWarning; } @@ -271,7 +271,7 @@ internal static bool IsConvertibleToFailure(in ResultLogic logic /// /// to check. /// True if the is convertible, otherwise false. - internal static bool IsConvertibleToWarning(in ResultLogic logic) + internal static bool IsConvertibleToWarning(ResultLogic logic) { return !logic.IsFailure; } @@ -283,7 +283,7 @@ internal static bool IsConvertibleToWarning(in ResultLogic logic /// to convert. /// A . [Pure] - internal static ResultLogic ToResultLogic(in ResultLogic logic) + internal static ResultLogic ToResultLogic(ResultLogic logic) { if (logic.IsSuccess && !logic.IsWarning) return new ResultLogic(); @@ -330,7 +330,7 @@ public override int GetHashCode() /// First to compare. /// Second to compare. /// True if both are equal, otherwise false. - public static bool operator ==(in ResultLogic result1, in ResultLogic result2) + public static bool operator ==(ResultLogic result1, ResultLogic result2) { if (ReferenceEquals(result1, result2)) return true; @@ -343,7 +343,7 @@ public override int GetHashCode() /// First to compare. /// Second to compare. /// True if both are not equal, otherwise false. - public static bool operator !=(in ResultLogic result1, in ResultLogic result2) + public static bool operator !=(ResultLogic result1, ResultLogic result2) { return !(result1 == result2); } @@ -368,7 +368,7 @@ public int CompareTo(ResultLogic other) /// The first to compare. /// The second to compare. /// The comparison result. - public static bool operator <(in ResultLogic left, in ResultLogic right) + public static bool operator <(ResultLogic left, ResultLogic right) { return left.CompareTo(right) < 0; } @@ -379,7 +379,7 @@ public int CompareTo(ResultLogic other) /// The first to compare. /// The second to compare. /// The comparison result. - public static bool operator <=(in ResultLogic left, in ResultLogic right) + public static bool operator <=(ResultLogic left, ResultLogic right) { return left.CompareTo(right) <= 0; } @@ -390,7 +390,7 @@ public int CompareTo(ResultLogic other) /// The first to compare. /// The second to compare. /// The comparison result. - public static bool operator >(in ResultLogic left, in ResultLogic right) + public static bool operator >(ResultLogic left, ResultLogic right) { return left.CompareTo(right) > 0; } @@ -401,7 +401,7 @@ public int CompareTo(ResultLogic other) /// The first to compare. /// The second to compare. /// The comparison result. - public static bool operator >=(in ResultLogic left, in ResultLogic right) + public static bool operator >=(ResultLogic left, ResultLogic right) { return left.CompareTo(right) >= 0; } diff --git a/src/Here/Result/ResultScopes.cs b/src/Here/Result/ResultScopes.cs index 60538b0..2c903f7 100644 --- a/src/Here/Result/ResultScopes.cs +++ b/src/Here/Result/ResultScopes.cs @@ -16,7 +16,7 @@ public static class ResultScope /// A . /// If the is null. [PublicAPI] - public static Result SafeResult([NotNull, InstantHandle] in Action action) + public static Result SafeResult([NotNull, InstantHandle] Action action) { Throw.IfArgumentNull(action, nameof(action)); @@ -38,7 +38,7 @@ public static Result SafeResult([NotNull, InstantHandle] in Action action) /// A . /// If the is null. [PublicAPI] - public static Result SafeResult([NotNull, InstantHandle] in Func action) + public static Result SafeResult([NotNull, InstantHandle] Func action) { Throw.IfArgumentNull(action, nameof(action)); @@ -59,7 +59,7 @@ public static Result SafeResult([NotNull, InstantHandle] in Func action) /// A . /// If the is null. [PublicAPI] - public static Result SafeValueResult([NotNull, InstantHandle] in Func> action) + public static Result SafeValueResult([NotNull, InstantHandle] Func> action) { Throw.IfArgumentNull(action, nameof(action)); @@ -82,7 +82,7 @@ public static Result SafeValueResult([NotNull, InstantHandle] in FuncIf the is null. /// If the is null. [PublicAPI] - public static CustomResult SafeCustomResult([NotNull, InstantHandle] in Func> action, [NotNull] in TError errorObject) + public static CustomResult SafeCustomResult([NotNull, InstantHandle] Func> action, [NotNull] TError errorObject) { Throw.IfArgumentNull(action, nameof(action)); Throw.IfArgumentNull(errorObject, nameof(errorObject)); @@ -106,7 +106,7 @@ public static CustomResult SafeCustomResult([NotNull, InstantHan /// If the is null. /// If the is null. [PublicAPI] - public static CustomResult SafeCustomResult([NotNull, InstantHandle] in Func> action, [NotNull] in Func errorFactory) + public static CustomResult SafeCustomResult([NotNull, InstantHandle] Func> action, [NotNull] Func errorFactory) { Throw.IfArgumentNull(action, nameof(action)); Throw.IfArgumentNull(errorFactory, nameof(errorFactory)); @@ -130,7 +130,7 @@ public static CustomResult SafeCustomResult([NotNull, InstantHan /// If the is null. /// If the is null. [PublicAPI] - public static Result SafeValueCustomResult([NotNull, InstantHandle] in Func> action, [NotNull] in TError errorObject) + public static Result SafeValueCustomResult([NotNull, InstantHandle] Func> action, [NotNull] TError errorObject) { Throw.IfArgumentNull(action, nameof(action)); Throw.IfArgumentNull(errorObject, nameof(errorObject)); @@ -154,7 +154,7 @@ public static Result SafeValueCustomResult([NotNull, Insta /// If the is null. /// If the is null. [PublicAPI] - public static Result SafeValueCustomResult([NotNull, InstantHandle] in Func> action, [NotNull] in Func errorFactory) + public static Result SafeValueCustomResult([NotNull, InstantHandle] Func> action, [NotNull] Func errorFactory) { Throw.IfArgumentNull(action, nameof(action)); Throw.IfArgumentNull(errorFactory, nameof(errorFactory)); diff --git a/src/Here/Result/ValueCustomErrorResult.cs b/src/Here/Result/ValueCustomErrorResult.cs index 9d86637..98160ac 100644 --- a/src/Here/Result/ValueCustomErrorResult.cs +++ b/src/Here/Result/ValueCustomErrorResult.cs @@ -12,7 +12,7 @@ namespace Here /// [PublicAPI] [DebuggerDisplay("{" + nameof(IsSuccess) + " ? \"IsSuccess\" + (" + nameof(IsWarning) + " ? \" with warning\" : System.String.Empty) + \", Value = \" + " + nameof(_value) + " : \"IsFailure\"}")] - public readonly partial struct Result : IResult, IResultError, IEquatable, IEquatable>, IComparable, IComparable> + public partial struct Result : IResult, IResultError, IEquatable, IEquatable>, IComparable, IComparable> { /// public bool IsSuccess => Logic.IsSuccess; @@ -59,7 +59,7 @@ public T Value /// "Ok" constructor. /// /// Result value. - internal Result([CanBeNull] in T value) + internal Result([CanBeNull] T value) { Logic = new ResultLogic(); _value = value; @@ -71,9 +71,9 @@ internal Result([CanBeNull] in T value) /// Embedded value. /// Result message. /// Result embedded exception. - internal Result([CanBeNull] in T value, [NotNull] in string message, [CanBeNull] in Exception exception) + internal Result([CanBeNull] T value, [NotNull] string message, [CanBeNull] Exception exception) { - Logic = new ResultLogic(true, message, default, exception); + Logic = new ResultLogic(true, message, default(TError), exception); _value = value; } @@ -83,10 +83,10 @@ internal Result([CanBeNull] in T value, [NotNull] in string message, [CanBeNull] /// Result message. /// Result error object. /// Result embedded exception. - internal Result([NotNull] in string message, [NotNull] in TError error, [CanBeNull] in Exception exception) + internal Result([NotNull] string message, [NotNull] TError error, [CanBeNull] Exception exception) { Logic = new ResultLogic(false, message, error, exception); - _value = default; + _value = default(T); } /// @@ -94,7 +94,7 @@ internal Result([NotNull] in string message, [NotNull] in TError error, [CanBeNu /// /// Result value. /// Result logic. - internal Result([CanBeNull] in T value, [NotNull] in ResultLogic logic) + internal Result([CanBeNull] T value, [NotNull] ResultLogic logic) { Logic = logic; _value = value; @@ -126,7 +126,7 @@ public Result Cast() /// A . /// If the is null. [PublicAPI, Pure] - public Result Cast([NotNull, InstantHandle] in Func converter) + public Result Cast([NotNull, InstantHandle] Func converter) { Throw.IfArgumentNull(converter, nameof(converter)); @@ -184,7 +184,7 @@ internal CustomResult ToFailCustomResult() /// Custom error object to use. /// A failed . [Pure] - internal CustomResult ToFailCustomResult([NotNull] in TError errorObject) + internal CustomResult ToFailCustomResult([NotNull] TError errorObject) { Debug.Assert(ResultLogic.IsConvertibleToFailure(Logic), "Cannot convert a success Result to a CustomResult failure."); return Result.CustomFail(Logic.Message, errorObject, Logic.Exception); @@ -209,7 +209,7 @@ internal Result ToFailValueCustomResult() /// Custom error object to use. /// A failed . [Pure] - internal Result ToFailValueCustomResult([NotNull] in TError errorObject) + internal Result ToFailValueCustomResult([NotNull] TError errorObject) { Debug.Assert(ResultLogic.IsConvertibleToFailure(Logic), "Cannot convert a success Result to a Result failure."); return Result.Fail(Logic.Message, errorObject, Logic.Exception); @@ -223,7 +223,7 @@ internal Result ToFailValueCustomResult([NotNull] in TError /// Exception to set in the failure . /// A failed . [Pure] - internal Result ToFailValueCustomResult([NotNull] in string additionalMessage, [CanBeNull] in Exception exception = null) + internal Result ToFailValueCustomResult([NotNull] string additionalMessage, [CanBeNull] Exception exception = null) { Debug.Assert(Logic.IsFailure, "Cannot convert a success Result to a Result failure."); return Result.Fail(Logic.Message + additionalMessage, Logic.Error, exception); @@ -237,7 +237,7 @@ internal Result ToFailValueCustomResult([NotNull] in string /// Exception to set in the warning . /// A warning . [Pure] - internal Result ToWarnValueCustomResult([NotNull] in string message, [CanBeNull] in Exception exception = null) + internal Result ToWarnValueCustomResult([NotNull] string message, [CanBeNull] Exception exception = null) { Debug.Assert(ResultLogic.IsConvertibleToWarning(Logic), "Cannot convert a warning Result to a Result warning."); return Result.Warn(_value, message, exception); @@ -253,7 +253,7 @@ internal Result ToWarnValueCustomResult([NotNull] in string message, /// to compare. /// True if both are equal and successful, otherwise false. [PublicAPI, Pure] - public bool SuccessEquals(in Result other) + public bool SuccessEquals(Result other) { return AreSuccessEqual(this, other); } @@ -288,7 +288,7 @@ public override bool Equals(object obj) /// Equality comparer to use to compare values. /// True if the value is equals to the given value, otherwise false. [PublicAPI, Pure] - internal static bool AreEqual(in Result result, [CanBeNull] in T value, [CanBeNull] in IEqualityComparer equalityComparer = null) + internal static bool AreEqual(Result result, [CanBeNull] T value, [CanBeNull] IEqualityComparer equalityComparer = null) { if (result.IsSuccess) return (equalityComparer ?? EqualityComparer.Default).Equals(result._value, value); @@ -303,7 +303,7 @@ internal static bool AreEqual(in Result result, [CanBeNull] in T valu /// Equality comparer to use to compare values. /// True if both are equal, otherwise false. [Pure] - internal static bool AreEqual(in Result result1, in Result result2, [CanBeNull] in IEqualityComparer equalityComparer = null) + internal static bool AreEqual(Result result1, Result result2, [CanBeNull] IEqualityComparer equalityComparer = null) { return result1.Logic.Equals(result2.Logic) && (equalityComparer ?? EqualityComparer.Default).Equals(result1._value, result2._value); @@ -317,7 +317,7 @@ internal static bool AreEqual(in Result result1, in Result /// Equality comparer to use to compare values. /// True if both are equal, otherwise false. [Pure] - internal static bool AreSuccessEqual(in Result result1, in Result result2, [CanBeNull] in IEqualityComparer equalityComparer = null) + internal static bool AreSuccessEqual(Result result1, Result result2, [CanBeNull] IEqualityComparer equalityComparer = null) { if (result1.IsSuccess && result2.IsSuccess) return AreEqual(result1, result2); @@ -330,7 +330,7 @@ internal static bool AreSuccessEqual(in Result result1, in ResultFirst to compare. /// Second to compare. /// True if both are equal, otherwise false. - public static bool operator ==(in Result result1, in Result result2) + public static bool operator ==(Result result1, Result result2) { return AreEqual(result1, result2); } @@ -341,7 +341,7 @@ internal static bool AreSuccessEqual(in Result result1, in ResultFirst to compare. /// Second to compare. /// True if both are not equal, otherwise false. - public static bool operator !=(in Result result1, in Result result2) + public static bool operator !=(Result result1, Result result2) { return !(result1 == result2); } @@ -358,7 +358,7 @@ public override int GetHashCode() /// that may embed a value to compare. /// Value to compare. /// True if the value is equals to the given value, otherwise false. - public static bool operator ==(in Result result, in T value) + public static bool operator ==(Result result, T value) { return AreEqual(result, value); } @@ -369,7 +369,7 @@ public override int GetHashCode() /// that may embed a value to compare. /// Value to compare. /// True if the value is not equals to the given value, otherwise false. - public static bool operator !=(in Result result, in T value) + public static bool operator !=(Result result, T value) { return !(result == value); } @@ -380,7 +380,7 @@ public override int GetHashCode() /// Value to compare. /// that may embed a value to compare. /// True if the value is equals to the given value, otherwise false. - public static bool operator ==(in T value, in Result result) + public static bool operator ==(T value, Result result) { return result == value; } @@ -391,7 +391,7 @@ public override int GetHashCode() /// Value to compare. /// that may embed a value to compare. /// True if the value is not equals to the given value, otherwise false. - public static bool operator !=(in T value, in Result result) + public static bool operator !=(T value, Result result) { return !(result == value); } @@ -436,7 +436,7 @@ public int CompareTo(Result other) /// The first to compare. /// The second to compare. /// The comparison result. - public static bool operator <(in Result left, in Result right) + public static bool operator <(Result left, Result right) { return left.CompareTo(right) < 0; } @@ -447,7 +447,7 @@ public int CompareTo(Result other) /// The first to compare. /// The second to compare. /// The comparison result. - public static bool operator <=(in Result left, in Result right) + public static bool operator <=(Result left, Result right) { return left.CompareTo(right) <= 0; } @@ -458,7 +458,7 @@ public int CompareTo(Result other) /// The first to compare. /// The second to compare. /// The comparison result. - public static bool operator >(in Result left, in Result right) + public static bool operator >(Result left, Result right) { return left.CompareTo(right) > 0; } @@ -469,7 +469,7 @@ public int CompareTo(Result other) /// The first to compare. /// The second to compare. /// The comparison result. - public static bool operator >=(in Result left, in Result right) + public static bool operator >=(Result left, Result right) { return left.CompareTo(right) >= 0; } diff --git a/src/Here/Result/ValueResult.cs b/src/Here/Result/ValueResult.cs index 4bd0551..5dda366 100644 --- a/src/Here/Result/ValueResult.cs +++ b/src/Here/Result/ValueResult.cs @@ -11,7 +11,7 @@ namespace Here /// [PublicAPI] [DebuggerDisplay("{" + nameof(IsSuccess) + " ? \"IsSuccess\" + (" + nameof(IsWarning) + " ? \" with warning\" : System.String.Empty) + \", Value = \" + " + nameof(_value) + " : \"IsFailure\"}")] - public readonly partial struct Result : IResult, IEquatable, IEquatable>, IComparable, IComparable> + public partial struct Result : IResult, IEquatable, IEquatable>, IComparable, IComparable> { /// public bool IsSuccess => Logic.IsSuccess; @@ -54,7 +54,7 @@ public T Value /// "Ok" constructor. /// /// Result value. - internal Result([CanBeNull] in T value) + internal Result([CanBeNull] T value) { Logic = new ResultLogic(); _value = value; @@ -67,7 +67,7 @@ internal Result([CanBeNull] in T value) /// Embedded value. /// Result message. /// Result embedded exception. - internal Result(bool isWarning, [CanBeNull] in T value, [NotNull] in string message, [CanBeNull] in Exception exception) + internal Result(bool isWarning, [CanBeNull] T value, [NotNull] string message, [CanBeNull] Exception exception) { Logic = new ResultLogic(isWarning, message, exception); _value = value; @@ -78,7 +78,7 @@ internal Result(bool isWarning, [CanBeNull] in T value, [NotNull] in string mess /// /// Result value. /// Result logic. - internal Result([CanBeNull] in T value, [NotNull] in ResultLogic logic) + internal Result([CanBeNull] T value, [NotNull] ResultLogic logic) { Logic = logic; _value = value; @@ -108,7 +108,7 @@ public Result Cast() /// A . /// If the is null. [PublicAPI, Pure] - public Result Cast([NotNull, InstantHandle] in Func converter) + public Result Cast([NotNull, InstantHandle] Func converter) { Throw.IfArgumentNull(converter, nameof(converter)); @@ -125,7 +125,7 @@ public Result Cast([NotNull, InstantHandle] in Func convert /// A . /// If the is null. [PublicAPI, Pure] - public CustomResult CustomCast([NotNull] in TError errorObject) + public CustomResult CustomCast([NotNull] TError errorObject) { Throw.IfArgumentNull(errorObject, nameof(errorObject)); @@ -144,7 +144,7 @@ public CustomResult CustomCast([NotNull] in TError errorObject) /// A . /// If the is null. [PublicAPI, Pure] - public CustomResult CustomCast([NotNull, InstantHandle] in Func errorFactory) + public CustomResult CustomCast([NotNull, InstantHandle] Func errorFactory) { Throw.IfArgumentNull(errorFactory, nameof(errorFactory)); @@ -164,7 +164,7 @@ public CustomResult CustomCast([NotNull, InstantHandle] in Func< /// A . /// If the is null. [PublicAPI, Pure] - public Result Cast([NotNull] in TError errorObject) + public Result Cast([NotNull] TError errorObject) where TOut : class { Throw.IfArgumentNull(errorObject, nameof(errorObject)); @@ -185,7 +185,7 @@ public Result Cast([NotNull] in TError errorObject) /// A . /// If the is null. [PublicAPI, Pure] - public Result Cast([NotNull, InstantHandle] in Func errorFactory) + public Result Cast([NotNull, InstantHandle] Func errorFactory) where TOut : class { Throw.IfArgumentNull(errorFactory, nameof(errorFactory)); @@ -208,7 +208,7 @@ public Result Cast([NotNull, InstantHandle] in Func< /// If the is null. /// If the is null. [PublicAPI, Pure] - public Result Cast([NotNull, InstantHandle] in Func converter, [NotNull] in TError errorObject) + public Result Cast([NotNull, InstantHandle] Func converter, [NotNull] TError errorObject) { Throw.IfArgumentNull(converter, nameof(converter)); Throw.IfArgumentNull(errorObject, nameof(errorObject)); @@ -231,7 +231,7 @@ public Result Cast([NotNull, InstantHandle] in Func< /// If the is null. /// If the is null. [PublicAPI, Pure] - public Result Cast([NotNull, InstantHandle] in Func converter, [NotNull, InstantHandle] in Func errorFactory) + public Result Cast([NotNull, InstantHandle] Func converter, [NotNull, InstantHandle] Func errorFactory) { Throw.IfArgumentNull(converter, nameof(converter)); Throw.IfArgumentNull(errorFactory, nameof(errorFactory)); @@ -279,7 +279,7 @@ internal Result ToFailValueResult() /// Exception to set in the failure . /// A failed . [Pure] - internal Result ToFailValueResult([NotNull] in string additionalMessage, [CanBeNull] in Exception exception = null) + internal Result ToFailValueResult([NotNull] string additionalMessage, [CanBeNull] Exception exception = null) { Debug.Assert(ResultLogic.IsConvertibleToFailure(Logic), "Cannot convert a success Result to a Result failure."); return Result.Fail(Logic.Message + additionalMessage, exception); @@ -291,7 +291,7 @@ internal Result ToFailValueResult([NotNull] in string additionalMess /// /// A failed . [Pure] - internal CustomResult ToFailCustomResult([NotNull] in TError errorObject) + internal CustomResult ToFailCustomResult([NotNull] TError errorObject) { Debug.Assert(ResultLogic.IsConvertibleToFailure(Logic), "Cannot convert a success Result to a CustomResult failure."); return Result.CustomFail(Logic.Message, errorObject, Logic.Exception); @@ -303,7 +303,7 @@ internal CustomResult ToFailCustomResult([NotNull] in TError err /// /// A failed . [Pure] - internal Result ToFailValueCustomResult([NotNull] in TError errorObject) + internal Result ToFailValueCustomResult([NotNull] TError errorObject) { Debug.Assert(ResultLogic.IsConvertibleToFailure(Logic), "Cannot convert a success Result to a Result failure."); return Result.Fail(Logic.Message, errorObject, Logic.Exception); @@ -317,7 +317,7 @@ internal Result ToFailValueCustomResult([NotNull] in /// Exception to set in the warning . /// A warning . [Pure] - internal Result ToWarnValueResult([NotNull] in string message, [CanBeNull] in Exception exception = null) + internal Result ToWarnValueResult([NotNull] string message, [CanBeNull] Exception exception = null) { Debug.Assert(ResultLogic.IsConvertibleToWarning(Logic), "Cannot convert a warning Result to a Result warning."); return Result.Warn(_value, message, exception); @@ -333,7 +333,7 @@ internal Result ToWarnValueResult([NotNull] in string message, [CanBeNull] in /// to compare. /// True if both are equal and successful, otherwise false. [PublicAPI, Pure] - public bool SuccessEquals(in Result other) + public bool SuccessEquals(Result other) { return AreSuccessEqual(this, other); } @@ -368,7 +368,7 @@ public override bool Equals(object obj) /// Equality comparer to use to compare values. /// True if the value is equals to the given value, otherwise false. [PublicAPI, Pure] - internal static bool AreEqual(in Result result, [CanBeNull] in T value, [CanBeNull] in IEqualityComparer equalityComparer = null) + internal static bool AreEqual(Result result, [CanBeNull] T value, [CanBeNull] IEqualityComparer equalityComparer = null) { if (result.IsSuccess) return (equalityComparer ?? EqualityComparer.Default).Equals(result._value, value); @@ -383,7 +383,7 @@ internal static bool AreEqual(in Result result, [CanBeNull] in T value, [CanB /// Equality comparer to use to compare values. /// True if both are equal, otherwise false. [Pure] - internal static bool AreEqual(in Result result1, in Result result2, [CanBeNull] in IEqualityComparer equalityComparer = null) + internal static bool AreEqual(Result result1, Result result2, [CanBeNull] IEqualityComparer equalityComparer = null) { return result1.Logic.Equals(result2.Logic) && (equalityComparer ?? EqualityComparer.Default).Equals(result1._value, result2._value); @@ -397,7 +397,7 @@ internal static bool AreEqual(in Result result1, in Result result2, [CanBe /// Equality comparer to use to compare values. /// True if both are equal, otherwise false. [Pure] - internal static bool AreSuccessEqual(in Result result1, in Result result2, [CanBeNull] in IEqualityComparer equalityComparer = null) + internal static bool AreSuccessEqual(Result result1, Result result2, [CanBeNull] IEqualityComparer equalityComparer = null) { if (result1.IsSuccess && result2.IsSuccess) return AreEqual(result1, result2); @@ -410,7 +410,7 @@ internal static bool AreSuccessEqual(in Result result1, in Result result2, /// First to compare. /// Second to compare. /// True if both are equal, otherwise false. - public static bool operator ==(in Result result1, in Result result2) + public static bool operator ==(Result result1, Result result2) { return AreEqual(result1, result2); } @@ -421,7 +421,7 @@ internal static bool AreSuccessEqual(in Result result1, in Result result2, /// First to compare. /// Second to compare. /// True if both are not equal, otherwise false. - public static bool operator !=(in Result result1, in Result result2) + public static bool operator !=(Result result1, Result result2) { return !(result1 == result2); } @@ -438,7 +438,7 @@ public override int GetHashCode() /// that may embed a value to compare. /// Value to compare. /// True if the value is equals to the given value, otherwise false. - public static bool operator ==(in Result result, in T value) + public static bool operator ==(Result result, T value) { return AreEqual(result, value); } @@ -449,7 +449,7 @@ public override int GetHashCode() /// that may embed a value to compare. /// Value to compare. /// True if the value is not equals to the given value, otherwise false. - public static bool operator !=(in Result result, in T value) + public static bool operator !=(Result result, T value) { return !(result == value); } @@ -460,7 +460,7 @@ public override int GetHashCode() /// Value to compare. /// that may embed a value to compare. /// True if the value is equals to the given value, otherwise false. - public static bool operator ==(in T value, in Result result) + public static bool operator ==(T value, Result result) { return result == value; } @@ -471,7 +471,7 @@ public override int GetHashCode() /// Value to compare. /// that may embed a value to compare. /// True if the value is not equals to the given value, otherwise false. - public static bool operator !=(in T value, in Result result) + public static bool operator !=(T value, Result result) { return !(result == value); } @@ -516,7 +516,7 @@ public int CompareTo(Result other) /// The first to compare. /// The second to compare. /// The comparison result. - public static bool operator <(in Result left, in Result right) + public static bool operator <(Result left, Result right) { return left.CompareTo(right) < 0; } @@ -527,7 +527,7 @@ public int CompareTo(Result other) /// The first to compare. /// The second to compare. /// The comparison result. - public static bool operator <=(in Result left, in Result right) + public static bool operator <=(Result left, Result right) { return left.CompareTo(right) <= 0; } @@ -538,7 +538,7 @@ public int CompareTo(Result other) /// The first to compare. /// The second to compare. /// The comparison result. - public static bool operator >(in Result left, in Result right) + public static bool operator >(Result left, Result right) { return left.CompareTo(right) > 0; } @@ -549,7 +549,7 @@ public int CompareTo(Result other) /// The first to compare. /// The second to compare. /// The comparison result. - public static bool operator >=(in Result left, in Result right) + public static bool operator >=(Result left, Result right) { return left.CompareTo(right) >= 0; } diff --git a/src/Here/Unit/Unit.cs b/src/Here/Unit/Unit.cs index fb4604a..8d80510 100644 --- a/src/Here/Unit/Unit.cs +++ b/src/Here/Unit/Unit.cs @@ -7,7 +7,7 @@ namespace Here /// Type that only have a unique value. /// [PublicAPI] - public readonly struct Unit : IEquatable, IComparable, IComparable + public struct Unit : IEquatable, IComparable, IComparable { /// /// Unique value. diff --git a/src/Here/ValueObject/ValueObject.cs b/src/Here/ValueObject/ValueObject.cs index 8d01b1c..cac1a29 100644 --- a/src/Here/ValueObject/ValueObject.cs +++ b/src/Here/ValueObject/ValueObject.cs @@ -25,7 +25,7 @@ public abstract class ValueObject /// First to compare. /// Second to compare. /// True if both are equal, otherwise false. - protected static bool EqualOperator(in ValueObject object1, in ValueObject object2) + protected static bool EqualOperator(ValueObject object1, ValueObject object2) { if (object1 is null) return object2 is null; @@ -40,7 +40,7 @@ protected static bool EqualOperator(in ValueObject object1, in ValueObject objec /// First to compare. /// Second to compare. /// True if both are not equal, otherwise false. - protected static bool NotEqualOperator(in ValueObject object1, in ValueObject object2) + protected static bool NotEqualOperator(ValueObject object1, ValueObject object2) { return !EqualOperator(object1, object2); }