removed some new lang features to support net6.0 and net7.0
All checks were successful
.NET Test / test (push) Successful in 1m5s
.NET Publish / publish (push) Successful in 51s

This commit is contained in:
2023-12-15 12:37:39 +04:00
parent c02fdc5492
commit 57e83fbafa
7 changed files with 76 additions and 60 deletions

View File

@@ -136,6 +136,7 @@ public readonly struct Result<T> : IEquatable<Result<T>>
{
Value = value;
State = ResultState.Success;
Error = default;
}
[Pure] public static explicit operator Result(Result<T> result) => result.State switch
@@ -263,7 +264,12 @@ public readonly struct SuccessUnit : IEquatable<SuccessUnit>
}
[Serializable]
public class ResultNotInitializedException(string variableName = "this") : InvalidOperationException("Result was not properly initialized.")
public class ResultNotInitializedException : InvalidOperationException
{
public string VariableName { get; } = variableName;
public ResultNotInitializedException(string variableName = "this")
: base("Result was not properly initialized.")
{
VariableName = variableName;
}
public string VariableName { get; }
}