ONIXLabs DotNET Library 12.0.0
We are excited to announce the release of ONIXLabs .NET Library version 12.0.0, now available on NuGet.
Core Updates
Extension methods exist for objects, allowing them to be wrapped as Result<T>
; for example
public Result<IEnumerable<Account>> GetAccounts()
{
try
{
return Data.AsEnumerable().ToSuccess();
}
catch(Exception exception)
{
return Result.Failure(exception);
}
}
A future release will likely include ToFailure
for exception results.
Extension methods exist for objects, allowing them to be wrapped as Optional<T>
; for example
public Optional<string> GetName()
{
return Data.Single(query)?.Name.ToOptional();
}
Note that if Name
were null, then this method would return None<string>
; otherwise Some<string>
for non-null values.
This also works for value-type (struct) objects.
Breaking Changes
Whislt there is a breaking change in this release, it is only minor. The extension methods ToSuccessResult
and ToSuccessResultAsync
have been renamed to ToSuccess
and ToSuccessAsync
respectively.