Don't throw NullReferenceException when accessing .Exception

master
Harald Wolff 2023-08-17 11:58:22 +02:00
parent 6a71ba43f6
commit 6c9933a593
2 changed files with 2 additions and 10 deletions

View File

@ -27,15 +27,7 @@ public class Optional<T>
return _exception is not null;
}
public Exception? Exception
{
get
{
if (_exception is null)
throw new NullReferenceException();
return _exception;
}
}
public Exception? Exception => _exception;
public T Value
{
get

View File

@ -6,7 +6,7 @@
<RepositoryUrl>https://nexus.l--n.de/repository/ln.net/</RepositoryUrl>
<UserSecretsId>e910e63e-c2c5-4d40-a00b-bd7c6461757e</UserSecretsId>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>0.1.0-preview6</Version>
<Version>0.1.0-preview7</Version>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
</PropertyGroup>