Refactor: items with DynamicData

This commit is contained in:
2022-04-22 09:09:14 +02:00
parent da3ccf4317
commit 76c6e30154
31 changed files with 281 additions and 141 deletions

View File

@@ -0,0 +1,11 @@
namespace FileTime.Tools.Extensions
{
public static class ObjectExtensions
{
public static TResult? MapNull<T, TResult>(this T obj, Func<TResult?> nullHandler, Func<T, TResult?> valueHandler)
=> obj == null ? nullHandler() : valueHandler(obj);
public static TResult? MapNull<T, TResult>(this T obj, Func<T, TResult?> valueHandler)
=> obj == null ? default : valueHandler(obj);
}
}

View File

@@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>